aboutsummaryrefslogtreecommitdiff
path: root/lisp/emms-player-mpd.el
diff options
context:
space:
mode:
authorMichael Olson <mwolson@gnu.org>2008-09-18 22:32:07 -0700
committerMichael Olson <mwolson@gnu.org>2008-09-18 22:32:07 -0700
commitaba7314b193d45a0ac0b6e44a8c2d860178a7c5e (patch)
tree622823e536889716828c3fbf48ec4d2a214da63b /lisp/emms-player-mpd.el
parent56a0223179942c6a7f8f90bf7c26922638ccb304 (diff)
emms-player-mpd: Allow periodic song-change timer to be suppressed.
* lisp/emms-player-mpd.el (emms-player-mpd-check-interval): Allow this to be nil. (emms-player-mpd-play): If nil, do just one check, so that we can record the current play/paused state. (emms-player-mpd-connect-1): If nil, don't install the timer.
Diffstat (limited to 'lisp/emms-player-mpd.el')
-rw-r--r--lisp/emms-player-mpd.el27
1 files changed, 17 insertions, 10 deletions
diff --git a/lisp/emms-player-mpd.el b/lisp/emms-player-mpd.el
index 7efe13f..24a647c 100644
--- a/lisp/emms-player-mpd.el
+++ b/lisp/emms-player-mpd.el
@@ -197,10 +197,14 @@ It should take same arguments as `open-network-stream' does."
(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.
-
-This is used only if `emms-player-mpd-sync-playlist' is non-nil"
- :type 'number
+next song. This may be an integer, a floating point number, or
+nil. If set to nil, this check will not be periodically
+performed.
+
+This variable is used only if `emms-player-mpd-sync-playlist' is
+non-nil."
+ :type '(choice (const :tag "Disable check" nil)
+ number)
:group 'emms-player-mpd)
(defcustom emms-player-mpd-verbose nil
@@ -848,9 +852,11 @@ playlist."
nil
(lambda (closure response)
(setq emms-player-mpd-current-song nil)
- (setq emms-player-mpd-status-timer
- (run-at-time t emms-player-mpd-check-interval
- 'emms-player-mpd-detect-song-change)))))
+ (if emms-player-mpd-check-interval
+ (setq emms-player-mpd-status-timer
+ (run-at-time t emms-player-mpd-check-interval
+ 'emms-player-mpd-detect-song-change))
+ (emms-player-mpd-detect-song-change)))))
;; we only want to play one track, so don't start the timer
(emms-player-mpd-send
"play"
@@ -913,9 +919,10 @@ This is called if `emms-player-mpd-sync-playlist' is non-nil."
(setq emms-player-paused-p t))
(unless (string= state "stop")
(emms-player-mpd-detect-song-change info)
- (setq emms-player-mpd-status-timer
- (run-at-time t emms-player-mpd-check-interval
- 'emms-player-mpd-detect-song-change)))))
+ (when emms-player-mpd-check-interval
+ (setq emms-player-mpd-status-timer
+ (run-at-time t emms-player-mpd-check-interval
+ 'emms-player-mpd-detect-song-change))))))
;;;###autoload
(defun emms-player-mpd-connect ()