diff options
author | Michael Olson <mwolson@gnu.org> | 2006-03-20 07:13:00 +0000 |
---|---|---|
committer | Michael Olson <mwolson@gnu.org> | 2006-03-20 07:13:00 +0000 |
commit | f128ac46140f1aa171a2f6f703693485e6a451c4 (patch) | |
tree | 28b4d8697d361d30d8226d9d602a1b2b1471c1a7 | |
parent | d580c73fbef1c4cc21cd1638b4581021df32a3c3 (diff) |
emms-player-mpd: Make pausing work after importing a playlist from MusicPD.
darcs-hash:20060320071337-1bfb2-7bba470fcb6076795954f2a73bb86b985ffd46e4.gz
-rw-r--r-- | emms-player-mpd.el | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/emms-player-mpd.el b/emms-player-mpd.el index 684cace..d52a2a7 100644 --- a/emms-player-mpd.el +++ b/emms-player-mpd.el @@ -434,20 +434,24 @@ MusicPD playlist." (mapc #'emms-playlist-insert-track (emms-player-mpd-get-tracks))) (setq emms-player-mpd-playlist-id (emms-player-mpd-get-playlist-id))) -(defun emms-player-mpd-detect-song-change () +(defun emms-player-mpd-detect-song-change (&optional info) "Detect whether a song change has occurred. -This is usually called by a timer." - (let* ((info (emms-player-mpd-get-status)) - (song (emms-player-mpd-get-current-song info)) - (status (emms-player-mpd-get-state info)) - (time (emms-player-mpd-get-playing-time info))) +This is usually called by a timer. + +If INFO is specified, use that instead of acquiring the necessary +info from MusicPD." + (unless info + (setq info (emms-player-mpd-get-status))) + (let ((song (emms-player-mpd-get-current-song info)) + (status (emms-player-mpd-get-state info)) + (time (emms-player-mpd-get-playing-time info))) (cond ((string= status "stop") (emms-cancel-timer emms-player-mpd-status-timer) (setq emms-player-mpd-status-timer nil) (setq emms-player-stopped-p t) (emms-player-stopped)) ((string= status "pause") - nil) + (setq emms-player-paused-p t)) ((string= status "play") (unless (or (null song) (and emms-player-mpd-current-song @@ -565,7 +569,10 @@ Afterward, the status of MusicPD will be tracked." (when emms-player-mpd-status-timer (emms-cancel-timer emms-player-mpd-status-timer)) (setq emms-player-mpd-current-song nil) - (emms-player-mpd-detect-song-change) + (let ((info (emms-player-mpd-get-status))) + (unless (string= (emms-player-mpd-get-state info) "stop") + (setq emms-player-playing-p 'emms-player-mpd)) + (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))) |