Reshaped the display of the ICY information.
[elisp.git] / media-mplayer.el
index 03ea5a1..fbcd87a 100644 (file)
@@ -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,18 @@ load Emacs less. Nil means no timing."
 
              ;; ----------------------------------------
 
+             ("ICY Info:" .
+              (progn
+                (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 nil)
+                  (message "ICY Info \"%s\"" param))
+                (if (and media/current-song-in-stream media/current-information)
+                    (media/show-current-information)))
+              )
+
+             ;; ----------------------------------------
+
              ("ANS_LENGTH" .
 
               (setq media/song-duration
@@ -171,8 +183,9 @@ load Emacs less. Nil means no timing."
                 (string-match "\\(.*\\)[\n\r]+" 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)
-          (media/mplayer/filter-subfunctions (match-string 1 line) (match-string 2 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)))
   )