>From e0492b1543d52a9977a5c39a6432260149d0c85c Mon Sep 17 00:00:00 2001 From: Julien Cubizolles Date: Fri, 14 Oct 2016 23:50:16 +0200 Subject: [PATCH 3/3] mplayer option to parse webradio playlists --- lisp/emms-stream-info.el | 15 ++++++++++----- lisp/emms-streams.el | 5 +++-- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/lisp/emms-stream-info.el b/lisp/emms-stream-info.el index 8cf8195..cb26cc5 100644 --- a/lisp/emms-stream-info.el +++ b/lisp/emms-stream-info.el @@ -57,13 +57,18 @@ (> (length (match-string-no-properties 1)) 0)) (setq ,symname (match-string-no-properties 1))))) -(defun emms-stream-info-mplayer-backend (url) +(defun emms-stream-info-mplayer-backend (url type) "Backend command for running mplayer on URL." + (cond ((eq type 'streamlist) + (setq urlcall "-playlist")) + ((eq type 'url) + (setq urlcall ""))) (condition-case excep (call-process "mplayer" nil t nil "-cache" "256" "-endpos" "0" "-vo" "null" "-ao" "null" "-msglevel" "all=-1:network=4:demuxer=4" + urlcall url) (file-error (error "Could not find the mplayer backend binary")))) @@ -77,7 +82,7 @@ (file-error (error "Could not find the VLC backend binary")))) -(defun emms-stream-info-call-backend (url) +(defun emms-stream-info-call-backend (url type) "Call backend and return a list of stream information for URL." (let ((name "N/A") (genre "N/A") @@ -87,7 +92,7 @@ (message "querying stream...") (cond ((eq *emms-stream-info-backend* 'mplayer) - (emms-stream-info-mplayer-backend url) + (emms-stream-info-mplayer-backend url type) (emms-stream-info-defreg name "^Name[ ]+:[ ]+\\(.*\\)$") (emms-stream-info-defreg genre "^Genre[ ]+:[ ]+\\(.*\\)$") (emms-stream-info-defreg bitrate "^Bitrate[ ]+:[ ]+\\(.*\\)$") @@ -103,10 +108,10 @@ (list name genre bitrate nowplaying))) ;; point of entry -(defun emms-stream-info-message (url) +(defun emms-stream-info-message (url type) "Display a message with information about the stream at URL." (interactive "Murl: ") - (let* ((stream-info (emms-stream-info-call-backend url)) + (let* ((stream-info (emms-stream-info-call-backend url type)) (name (nth 0 stream-info)) (genre (nth 1 stream-info)) (bitrate (nth 2 stream-info)) diff --git a/lisp/emms-streams.el b/lisp/emms-streams.el index 41de8d2..3b19224 100644 --- a/lisp/emms-streams.el +++ b/lisp/emms-streams.el @@ -478,8 +478,9 @@ Don't forget to save your modifications !" (interactive) (if (fboundp 'emms-stream-info-message) (let* ((line (get-text-property (point) 'emms-stream)) - (url (emms-stream-url line))) - (emms-stream-info-message url)) + (url (emms-stream-url line)) + (type (emms-stream-type line))) + (emms-stream-info-message url type)) (message "Streaming media info not available."))) ;; Killing and yanking -- 2.7.4