From: Francois Fleuret Date: Wed, 11 Mar 2015 12:37:04 +0000 (+0100) Subject: Cosmetics. X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=commitdiff_plain;h=1ecbbd03909c6f7dda43117d8e8054a39427cb61;p=elisp.git Cosmetics. --- diff --git a/media-mplayer.el b/media-mplayer.el index fbcd87a..77f1516 100644 --- a/media-mplayer.el +++ b/media-mplayer.el @@ -81,8 +81,15 @@ load Emacs less. Nil means no timing." ("ICY Info:" . (progn + ;; (message "ICY Info \"%s\"" param) (if (string-match "StreamTitle='\\([^;]*\\)';" param) - (setq media/current-song-in-stream (concat (match-string 1 param) " | " (current-time-string))) + (setq media/current-song-in-stream + (let ((s (match-string 1 param))) + (concat (if (string= s "") "" s) + " | " + ;; (current-time-string) + (format-time-string "%a %b %d %H:%M:%S") + ))) (setq media/current-song-in-stream nil) (message "ICY Info \"%s\"" param)) (if (and media/current-song-in-stream media/current-information) diff --git a/media.el b/media.el index 299ccba..b7b1a4e 100644 --- a/media.el +++ b/media.el @@ -247,6 +247,10 @@ parsed from the stream.") ;; Finding and playing URLs ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defun media/reset-current-information () + (setq media/current-information nil + media/current-song-in-stream nil)) + (defun media/format-url (url) (if (string-match "^file:.*/\\([^/]+\\)$" url) (match-string 1 url) @@ -258,8 +262,7 @@ parsed from the stream.") (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/current-song-in-stream nil) + (media/reset-current-information) (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))) @@ -827,8 +830,7 @@ returns nil if no id3 tags could be found." (defun media/stop () (interactive) (message "Stop") - (setq media/current-information nil - media/current-song-in-stream nil) + (media/reset-current-information) (media/api/stop)) (defun media/queue-song-at-point () @@ -878,15 +880,13 @@ 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/current-song-in-stream nil) + (media/reset-current-information) (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/current-song-in-stream nil) + (media/reset-current-information) (media/remove-highlight)))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -939,7 +939,8 @@ which stops when the songs ends." (or (and (string= (car media/played-information) (nth 0 media/current-information)) (cdr media/played-information)) (replace-regexp-in-string "^.*/\\([^/]*\\)$" "\\1" (nth 0 media/current-information))) - (if media/current-song-in-stream (concat "[" media/current-song-in-stream "] ") "") + ;; (if media/current-song-in-stream (concat "[" media/current-song-in-stream "] ") "") + (if media/current-song-in-stream (concat "| " media/current-song-in-stream " ") "") (nth 1 media/current-information) (if (= 2 (nth 2 media/current-information)) "stereo" "mono") (nth 3 media/current-information))