X-Git-Url: https://www.fleuret.org/cgi-bin/gitweb/gitweb.cgi?p=elisp.git;a=blobdiff_plain;f=media.el;h=25b19ec4699456c4d843949fe9df245aee683f28;hp=c193b45b21cbd39c093affcd24fae510815f50bd;hb=6a44bdf65c8691602f917c8d5b4d8d751efa83d7;hpb=0785fb27e9d9eeb8d19dd8e1bfad8e520b04bb4c diff --git a/media.el b/media.el index c193b45..25b19ec 100644 --- a/media.el +++ b/media.el @@ -254,6 +254,7 @@ and the bitrate. Should be nil if no information is available.") (time (get-text-property position 'time))) (if (not url) (media/remove-highlight) (run-hook-with-args 'media/before-play-hook url) + (setq media/current-information nil) (media/api/play url) ;; We keep the information of the url and the title (setq media/played-information (cons url (get-text-property position 'title))) @@ -821,6 +822,7 @@ returns nil if no id3 tags could be found." (defun media/stop () (interactive) (message "Stop") + (setq media/current-information nil) (media/api/stop)) (defun media/queue-song-at-point () @@ -868,6 +870,19 @@ the 'Queue' playlist, and plays it if no song is currently playing." ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defun media/player-error () + (message "Player error") + (setq media/current-information nil) + (media/remove-highlight)) + +(defun media/song-terminates () + (with-current-buffer media/buffer + (if media/continue-mode (media/play-next t) + (setq media/current-information nil) + (media/remove-highlight)))) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + (defun media/switch-continue-mode () "Switches between a mode which automatically chains files and a mode which stops when the songs ends." @@ -878,15 +893,6 @@ which stops when the songs ends." (message "Continue mode switched off.")) ) -(defun media/player-error () - (message "Player error") - (media/remove-highlight)) - -(defun media/song-terminates () - (with-current-buffer media/buffer - (if media/continue-mode (media/play-next t) - (media/remove-highlight)))) - (defun media/duration-to-string (duration) (let ((sec (mod duration 60)) (min (/ duration 60)))