diff options
-rw-r--r-- | emms-player-mpd.el | 5 | ||||
-rw-r--r-- | emms-player-simple.el | 9 | ||||
-rw-r--r-- | emms.el | 12 |
3 files changed, 17 insertions, 9 deletions
diff --git a/emms-player-mpd.el b/emms-player-mpd.el index 2c687fa..6a69174 100644 --- a/emms-player-mpd.el +++ b/emms-player-mpd.el @@ -609,12 +609,13 @@ MusicPD playlist." (and (stringp emms-player-mpd-current-song) (string= song emms-player-mpd-current-song))) (setq emms-player-mpd-current-song song) - (run-hooks 'emms-player-stopped-hook) + (let ((emms-player-stopped-p t)) + (emms-player-stopped)) (with-current-emms-playlist (emms-playlist-select (progn (goto-line (1+ (string-to-number song))) (point)))) - (run-hooks 'emms-player-started-hook) + (emms-player-started 'emms-player-mpd) (when time (run-hook-with-args 'emms-player-seeked-functions time))))))) diff --git a/emms-player-simple.el b/emms-player-simple.el index 9bb8196..500289c 100644 --- a/emms-player-simple.el +++ b/emms-player-simple.el @@ -86,6 +86,7 @@ to call the player and ARGS are the command line arguements." (defun ,start (track) "Start the player process." (emms-player-simple-start (emms-track-name track) + ,player-name ,command-name ,parameters)) (defun ,stop () @@ -108,9 +109,10 @@ to call the player and ARGS are the command line arguements." (delete-process process)))) ;; Utility-functions -(defun emms-player-simple-start (filename cmdname params) +(defun emms-player-simple-start (filename player cmdname params) "Starts a process playing FILENAME using the specified CMDNAME with -the specified PARAMS." +the specified PARAMS. +PLAYER is the name of the current player." (let ((process (apply 'start-process emms-player-simple-process-name nil @@ -118,7 +120,8 @@ the specified PARAMS." ;; splice in params here (append params (list filename))))) ;; add a sentinel for signaling termination - (set-process-sentinel process 'emms-player-simple-sentinel))) + (set-process-sentinel process 'emms-player-simple-sentinel)) + (emms-player-started player)) (defun emms-player-simple-sentinel (proc str) "Sentinel for determining the end of process" @@ -1037,10 +1037,14 @@ or nil if no such player exists." (if (not player) (error "Don't know how to play track: %s" track) (funcall (emms-player-get player 'start) - track) - (setq emms-player-playing-p player - emms-player-paused-p nil) - (run-hooks 'emms-player-started-hook))))) + track))))) + +(defun emms-player-started (player) + "Declare that the given EMMS PLAYER has started. +This should only be done by the current player itself." + (setq emms-player-playing-p player + emms-player-paused-p nil) + (run-hooks 'emms-player-started-hook)) (defun emms-player-stop () "Stop the current EMMS player." |