aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--emms-player-mpd.el17
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."