diff options
author | Michael Olson <mwolson@gnu.org> | 2006-05-25 03:31:00 +0000 |
---|---|---|
committer | Michael Olson <mwolson@gnu.org> | 2006-05-25 03:31:00 +0000 |
commit | a92fa296433cf56276b070c68ad3b9ecb1d164f9 (patch) | |
tree | 84c78c1021ba2378d94e213d6d65ee553ec60109 | |
parent | 08f9d4ef1c96d8b1075260cfcc61cf8e394a3fa1 (diff) |
emms-player-mpd: Make seek work correctly.
darcs-hash:20060525033120-1bfb2-00e9ea6d64e0c95fcac1105468024881d0a2faba.gz
-rw-r--r-- | emms-player-mpd.el | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/emms-player-mpd.el b/emms-player-mpd.el index 220f102..052be3f 100644 --- a/emms-player-mpd.el +++ b/emms-player-mpd.el @@ -900,13 +900,18 @@ from other functions." (interactive) (emms-player-mpd-send "pause" nil #'ignore)) -(defun emms-player-mpd-seek (sec) - "Seek backward or forward by SEC seconds, depending on sign of SEC." +(defun emms-player-mpd-seek (amount) + "Seek backward or forward by AMOUNT seconds, depending on sign of AMOUNT." (interactive) - (emms-player-mpd-send (format "seek %s%d" - (if (> sec 0) "+" "") - sec) - nil #'ignore)) + (emms-player-mpd-get-status + amount + (lambda (amount info) + (let ((song (emms-player-mpd-get-current-song nil #'ignore info)) + (secs (emms-player-mpd-get-playing-time nil #'ignore info))) + (when (and song secs) + (emms-player-mpd-send + (concat "seek " song " " (number-to-string (+ secs amount))) + nil #'ignore)))))) (defun emms-player-mpd-next () "Move forward by one track in MusicPD's internal playlist." |