;; ----------------------------------------
("ICY Info:" .
- (if (string-match "StreamTitle='\\([^;]*\\)';" param)
- (setq media/mplayer/current-stream-song (match-string 1 param))
- (message "ICY Info \"%s\"" param)))
+ (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)))
+ )
;; ----------------------------------------
(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))))
-
- (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)))
)
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
))
"Contains the name of the current file playing, the frequency in Hz
and the bitrate. Should be nil if no information is available.")
+(defvar media/current-song-in-stream nil
+ "Contains the title of the current song playing, as it may be
+parsed from the stream.")
+
(defvar media/buffer nil
"The main buffer for the media player mode.")
(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)
+ (setq media/current-information nil
+ media/current-song-in-stream nil)
(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)))
(defun media/stop () (interactive)
(message "Stop")
- (setq media/current-information nil)
+ (setq media/current-information nil
+ media/current-song-in-stream nil)
(media/api/stop))
(defun media/queue-song-at-point ()
(defun media/player-error ()
(message "Player error")
- (setq media/current-information nil)
+ (setq media/current-information nil
+ media/current-song-in-stream nil)
(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)
+ (setq media/current-information nil
+ media/current-song-in-stream nil)
(media/remove-highlight))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
"Print a message with informations about the song currently playing"
(interactive)
(if media/current-information
- (message "Now playing %s (%dHz, %s, %dkbit/s)"
+ (message "Now playing %s %s(%dHz, %s, %dkbit/s)"
(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 "] ") "")
(nth 1 media/current-information)
(if (= 2 (nth 2 media/current-information)) "stereo" "mono")
(nth 3 media/current-information))