aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Olson <mwolson@gnu.org>2006-04-12 03:51:00 +0000
committerMichael Olson <mwolson@gnu.org>2006-04-12 03:51:00 +0000
commitb18fa304660f9cf4ce66a79834763e471adf0b40 (patch)
treef10d3435f5cdf2c69456f23c79b35119e0bbbe95
parent85576f435200a8a40686e78fda148cf4047fba3b (diff)
Make `emms-player-started' function, which serves the same purpose as `emms-player-stopped', in that it is meant to be called by the player. emms-player-mpd needs this so that it can tell EMMS exactly when playback has begun.
darcs-hash:20060412035132-1bfb2-d4982d0b49ca4b949c353f2702ceca4318078bb3.gz
-rw-r--r--emms-player-mpd.el5
-rw-r--r--emms-player-simple.el9
-rw-r--r--emms.el12
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"
diff --git a/emms.el b/emms.el
index d50b8f3..10fa92e 100644
--- a/emms.el
+++ b/emms.el
@@ -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."