Location: lg@xxxxxxxxxxxxxx http://arch.xwem.org/2005/
Revision: xwem--main--2.2--patch-41
Archive: lg@xxxxxxxxxxxxxx
Creator: Zajcev Evgeny <lg@xxxxxxxx>
Date: Tue Nov 22 22:25:36 MSK 2005
Standard-date: 2005-11-22 19:25:36 GMT
Modified-files: dockapp/xwem-mpd.el
New-patches: lg@xxxxxxxxxxxxxx/xwem--main--2.2--patch-41
steve@xxxxxxxxxxxxxx/xwem--steve--2.2--patch-12
steve@xxxxxxxxxxxxxx/xwem--steve--2.2--patch-13
Summary: Merges from steve, xwem-mpd fixes
Keywords: xwem-mpd, compile, google-query
* dockapp/xwem-mpd.el: Merge from steve, clean ups compilation. Use
`google-query' instead of w3m, STOPED typo fix, `parse-integer'
substituted with `string-to-int', etc
* added files
{arch}/xwem/xwem--main/xwem--main--2.2/lg@xxxxxxxxxxxxxx/patch-log/patch-41
{arch}/xwem/xwem--steve/xwem--steve--2.2/steve@xxxxxxxxxxxxxx/patch-log/patch-12
{arch}/xwem/xwem--steve/xwem--steve--2.2/steve@xxxxxxxxxxxxxx/patch-log/patch-13
* modified files
--- orig/dockapp/xwem-mpd.el
+++ mod/dockapp/xwem-mpd.el
@@ -43,6 +43,11 @@
;;; Code:
+(require 'xwem-osd)
+
+(eval-when-compile
+ (autoload 'google-query "google-query" nil t))
+
(defgroup xwem-mpd nil
"Group to customize mpd."
:prefix "xwem-"
@@ -53,7 +58,9 @@
:type 'number
:group 'xwem-mpd)
-(defcustom xwem-mpd-lyrics-dir "~/musicpd/lyrics/"
+(defcustom xwem-mpd-lyrics-dir
+ (file-name-as-directory
+ (expand-file-name "musicpd/lyrics" (user-home-directory)))
"Directory containing songs lyrics."
:type 'directory
:group 'xwem-mpd)
@@ -73,12 +80,28 @@
(lyrics :place bottom-right :depth 0 :icon "mini-lyrics.xpm")
(volume :place right :depth 1 :font "fixed" :color "white")
(state :place center :depth 1 :font
"-*-helvetica-bold-r-*-*-20-*-*-*-*-*-*-*"
- :color "red3" :format (or (and (mpd-stopped-p) "STOPED") (and
(mpd-paused-p) "PAUSED"))))
+ :color "red3" :format (or (and (mpd-stopped-p) "STOPPED") (and
(mpd-paused-p) "PAUSED"))))
"Mpd dockapp configuration.
:place is not yet implemented."
:type 'list
:group 'xwem-mpd)
+(defcustom mpd-after-command-hook nil
+ "Hooks to run after MPD command is executed.
+Executed command name stored in `mpd-this-command'."
+ :type 'hook
+ :group 'xwem-mpd)
+
+(defcustom mpd-before-variables-update-hook nil
+ "Hooks to run before updating mpd variables."
+ :type 'hook
+ :group 'xwem-mpd)
+
+(defcustom mpd-after-variables-update-hook nil
+ "Hooks to run after mpd variables has been updated."
+ :type 'hook
+ :group 'xwem-mpd)
+
(defvar mpd-process nil)
(defvar mpd-itimer nil)
@@ -90,14 +113,16 @@
(not (eq mpd-process 'open)))
(setq mpd-process (open-network-stream "mpd" " *mpd connection*"
"localhost" 6600))
- (set-process-coding-system mpd-process 'utf-8 'utf-8)
+ (when (fboundp 'set-process-coding-system)
+ (set-process-coding-system mpd-process 'utf-8 'utf-8))
(set-process-filter mpd-process 'mpd-process-filter)
(set-process-sentinel mpd-process 'mpd-process-sentinel)
+ (process-kill-without-query mpd-process)
(add-hook 'mpd-after-command-hook 'mpd-update-variables)
(setq mpd-itimer
- (run-with-timer xwem-mpd-update-rate xwem-mpd-update-rate
- 'mpd-update-variables))))
+ (start-itimer "mpd-vars-update" #'mpd-update-variables
+ xwem-mpd-update-rate xwem-mpd-update-rate))))
;; mpd variables
(defvar mpd-zero-vars-p t)
@@ -144,14 +169,6 @@
(defvar **mpd-var-volume* nil)
(defvar **mpd-var-xfade* nil)
-(defvar mpd-after-command-hook nil
- "Hooks to run after MPD command is executed.
-Executed command name stored in `mpd-this-command'.")
-(defvar mpd-before-variables-update-hook nil
- "Hooks to run before updating mpd variables.")
-(defvar mpd-after-variables-update-hook nil
- "Hooks to run after mpd variables has been updated.")
-
(defvar mpd-this-command nil
"The mpd command currently executing.
Useful to use in `mpd-after-command-hook' hooks.")
@@ -182,8 +199,8 @@
(if **mpd-var-time*
(destructuring-bind (a b)
(split-string **mpd-var-time* ":")
- (cons (parse-integer a) (parse-integer b)))
- (cons 0 1))) ;todo?
+ (cons (string-to-int a) (string-to-int b)))
+ (cons 0 1))) ; todo?
(define-mpd-command mpd-volume-up ()
(interactive)
@@ -287,6 +304,9 @@
(insert text)
(save-buffer))))))
+;; This has to allow for the possibility of being called when there
+;; are no SXEmacs frames focused, so it forces a new SXEmacs frame to
+;; be created. Ugly, yes, but I couldn't think of a better way. --SY.
(define-xwem-command mpd-lyric-show ()
"Show lyrics for now playing song."
(xwem-interactive)
@@ -294,12 +314,11 @@
(let ((b (find-file-noselect (mpd-lyric-filename))))
(xwem-special-popup-frame b))
(when (and **mpd-var-Artist* **mpd-var-Title*)
- (require 'w3m)
- (browse-url
- (format "http://www.google.com/search?q=%s"
- (w3m-url-encode-string
- (format "\"%s\" \"%s\" lyrics"
- **mpd-var-Artist* **mpd-var-Title*)))))))
+ (let ((lyric-frame (new-frame)))
+ (select-frame lyric-frame)
+ (google-query (format "\"%s\" \"%s\" lyrics"
+ **mpd-var-Artist* **mpd-var-Title*))
+ (focus-frame lyric-frame)))))
;;;; Dockapp section
|