From: Francois Fleuret Date: Tue, 10 Mar 2015 10:37:09 +0000 (+0100) Subject: Added the parsing of the ICY info to have titles playing in streams. X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?p=elisp.git;a=commitdiff_plain;h=9ce1b351cb837d2176bfcc75bc94e616449c61ff Added the parsing of the ICY info to have titles playing in streams. --- diff --git a/media-mplayer.el b/media-mplayer.el index 03ea5a1..4a6209f 100644 --- a/media-mplayer.el +++ b/media-mplayer.el @@ -68,9 +68,9 @@ load Emacs less. Nil means no timing." ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun media/mplayer/filter-subfunctions (cmd param) - ;; (unless (string= cmd "A:") - ;; (message "cmd=%s param=%s" cmd param) - ;; ) + ;; (unless (string= cmd "A:") + ;; (message "cmd=%s param=%s" cmd param) + ;; ) (eval (cdr (assoc cmd @@ -79,6 +79,13 @@ load Emacs less. Nil means no timing." ;; ---------------------------------------- + ("ICY Info:" . + (if (string-match "StreamTitle='\\([^']*\\)';" param) + (message "Now in stream \"%s\"" (match-string 1 param)) + (message "ICY Info \"%s\"" param))) + + ;; ---------------------------------------- + ("ANS_LENGTH" . (setq media/song-duration @@ -171,7 +178,7 @@ load Emacs less. Nil means no timing." (string-match "\\(.*\\)[\n ]+" media/mplayer/buffer start)) (setq start (1+ (match-end 1))) (let ((line (match-string 1 media/mplayer/buffer))) - (when (string-match "^\\(AUDIO:\\|Exiting...\\|Starting\\|ANS_LENGTH\\|ANS_TIME_POSITION\\|Cache fill:\\) *\\(.*\\)$" line) + (when (string-match "^\\(AUDIO:\\|Exiting...\\|Starting\\|ANS_LENGTH\\|ANS_TIME_POSITION\\|Cache fill:\\|ICY Info:\\) *\\(.*\\)$" line) (media/mplayer/filter-subfunctions (match-string 1 line) (match-string 2 line))))) (setq media/mplayer/buffer (substring media/mplayer/buffer start))) )