From 9ce1b351cb837d2176bfcc75bc94e616449c61ff Mon Sep 17 00:00:00 2001 From: Francois Fleuret Date: Tue, 10 Mar 2015 11:37:09 +0100 Subject: [PATCH] Added the parsing of the ICY info to have titles playing in streams. --- media-mplayer.el | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) 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))) ) -- 2.20.1