From 4a873b05b48e1b3bca23499494cff40bf6a3e74a Mon Sep 17 00:00:00 2001 From: Michael Olson Date: Sun, 2 Jul 2006 01:21:00 +0000 Subject: Allow player to set the exact elapsed time of a track. emms-player-mpd and emms-player-mpg321-remote both need this. darcs-hash:20060702012131-1bfb2-3e6229d68adf0d78574e0fc6cd1c1a4438c870c3.gz --- emms-playing-time.el | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'emms-playing-time.el') diff --git a/emms-playing-time.el b/emms-playing-time.el index 659e391..3176dcf 100644 --- a/emms-playing-time.el +++ b/emms-playing-time.el @@ -103,6 +103,12 @@ should enable `emms-playing-time-display-p' first, though." (when (< emms-playing-time 0) ; back to start point (setq emms-playing-time 0))) +(defun emms-playing-time-set (sec) + "Set the playing time to SEC." + (setq emms-playing-time sec) + (when (< emms-playing-time 0) ; back to start point + (setq emms-playing-time 0))) + (defun emms-playing-time (arg) "Turn on emms playing time if ARG is positive, off otherwise." (interactive "p") @@ -114,7 +120,8 @@ should enable `emms-playing-time-display-p' first, though." (add-hook 'emms-player-stopped-hook 'emms-playing-time-stop) (add-hook 'emms-player-finished-hook 'emms-playing-time-stop) (add-hook 'emms-player-paused-hook 'emms-playing-time-pause) - (add-hook 'emms-player-seeked-functions 'emms-playing-time-seek)) + (add-hook 'emms-player-seeked-functions 'emms-playing-time-seek) + (add-hook 'emms-player-time-set-functions 'emms-playing-time-set)) (setq emms-playing-time-display-p nil) (emms-playing-time-stop) (emms-playing-time-restore-mode-line) @@ -122,7 +129,8 @@ should enable `emms-playing-time-display-p' first, though." (remove-hook 'emms-player-stopped-hook 'emms-playing-time-stop) (remove-hook 'emms-player-finished-hook 'emms-playing-time-stop) (remove-hook 'emms-player-paused-hook 'emms-playing-time-pause) - (remove-hook 'emms-player-seeked-functions 'emms-playing-time-seek))) + (remove-hook 'emms-player-seeked-functions 'emms-playing-time-seek) + (remove-hook 'emms-player-time-set-functions 'emms-playing-time-set))) ;;;###autoload (defun emms-playing-time-enable () -- cgit v1.2.3