aboutsummaryrefslogtreecommitdiff
path: root/emms-player-mpd.el
diff options
context:
space:
mode:
authorMichael Olson <mwolson@gnu.org>2006-07-30 21:50:00 +0000
committerMichael Olson <mwolson@gnu.org>2006-07-30 21:50:00 +0000
commitab3184047fd4ff9373bacccd8f583674ba738849 (patch)
tree86b345def6ba9a977ebfdc26fce125a89c87e52f /emms-player-mpd.el
parent9e243bd6c4fdc71083203116d98af41ba00851ea (diff)
emms-player-mpd: Allow a password to be sent to the MusicPD server.
darcs-hash:20060730215000-1bfb2-492d75142915235bcc52d20e92d7d9973dfd8053.gz
Diffstat (limited to 'emms-player-mpd.el')
-rw-r--r--emms-player-mpd.el21
1 files changed, 19 insertions, 2 deletions
diff --git a/emms-player-mpd.el b/emms-player-mpd.el
index 650a9b1..143f9bf 100644
--- a/emms-player-mpd.el
+++ b/emms-player-mpd.el
@@ -23,7 +23,7 @@
;;; Commentary:
-;;; Benefits
+;;; Benefits of MusicPD
;; MusicPD features crossfade, very little skipping, minor CPU usage,
;; many clients, many supported output formats, fast manipulation via
@@ -67,6 +67,11 @@
;; (setq emms-player-mpd-server-name "localhost")
;; (setq emms-player-mpd-server-port "6600")
+;; If your MusicPD setup requires a password, you will need to do the
+;; following.
+;;
+;; (setq emms-player-mpd-server-password "mypassword")
+
;; To get track info from MusicPD, do the following.
;;
;; (add-to-list 'emms-info-functions 'emms-info-mpd)
@@ -167,6 +172,12 @@ It should take same arguments as `open-network-stream' does."
:type '(choice number string)
:group 'emms-player-mpd)
+(defcustom emms-player-mpd-server-password nil
+ "The port of the MusicPD server that we should connect to."
+ :type '(choice (const :tag "None" nil)
+ string)
+ :group 'emms-player-mpd)
+
(defcustom emms-player-mpd-check-interval 1
"How often to check to see whether MusicPD has advanced to the
next song. This may be an integer or a floating point number.
@@ -355,7 +366,13 @@ return at the end of a request.")
(emms-player-mpd-tq-create emms-player-mpd-process))
(if (fboundp 'set-process-query-on-exit-flag)
(set-process-query-on-exit-flag emms-player-mpd-process nil)
- (process-kill-without-query emms-player-mpd-process))))
+ (process-kill-without-query emms-player-mpd-process))
+ ;; send password
+ (when (stringp emms-player-mpd-server-password)
+ (emms-player-mpd-tq-enqueue
+ emms-player-mpd-queue
+ (concat "password " emms-player-mpd-server-password "\n")
+ emms-player-mpd-status-regexp nil #'ignore))))
(defun emms-player-mpd-send (question closure fn)
"Send the given QUESTION to the MusicPD server.