emms-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emms-patches] [COMMIT] emms-player-mpd: Allow periodic song-change time


From: Michael Olson
Subject: [Emms-patches] [COMMIT] emms-player-mpd: Allow periodic song-change timer to be suppressed.
Date: Thu, 18 Sep 2008 22:32:07 -0700

* 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.
---
 lisp/emms-player-mpd.el |   27 +++++++++++++++++----------
 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 ()
-- 
debian.1.5.6.1.19.ge6b2





reply via email to

[Prev in Thread] Current Thread [Next in Thread]