Displays the song's name after the stream actually starts playing.
authorFrancois Fleuret <francois@fleuret.org>
Tue, 10 Mar 2015 11:23:09 +0000 (12:23 +0100)
committerFrancois Fleuret <francois@fleuret.org>
Tue, 10 Mar 2015 11:23:09 +0000 (12:23 +0100)
media-mplayer.el

index a6cd0e9..dd953be 100644 (file)
@@ -81,7 +81,7 @@ load Emacs less. Nil means no timing."
 
              ("ICY Info:" .
               (if (string-match "StreamTitle='\\([^']*\\)';" param)
-                  (message "Now in stream (%s) \"%s\"" (current-time-string) (match-string 1 param))
+                  (setq media/mplayer/current-stream-song (match-string 1 param))
                 (message "ICY Info \"%s\"" param)))
 
              ;; ----------------------------------------
@@ -179,7 +179,13 @@ load Emacs less. Nil means no timing."
       (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:\\|ICY Info:\\) *\\(.*\\)$" line)
-          (media/mplayer/filter-subfunctions (match-string 1 line) (match-string 2 line)))))
+          (media/mplayer/filter-subfunctions (match-string 1 line) (match-string 2 line))))
+
+      (when (and media/mplayer/current-stream-song media/current-information)
+        (message "Now in stream (%s) \"%s\""
+                 (current-time-string) media/mplayer/current-stream-song)
+        (setq media/mplayer/current-stream-song nil))
+      )
     (setq media/mplayer/buffer (substring media/mplayer/buffer start)))
   )
 
@@ -219,6 +225,7 @@ load Emacs less. Nil means no timing."
         media/mplayer/paused nil
         media/song-duration nil
         media/song-current-time nil
+        media/mplayer/current-stream-song nil
         media/mplayer/cumulated-duration 0
         media/mplayer/last-current-time nil
         ))