From f8e9b2e6099dd569e971b32c3a733ea8e5e0952d Mon Sep 17 00:00:00 2001 From: jao Date: Sun, 31 Jul 2022 03:58:06 +0100 Subject: jao-mpc: playing http radio streams --- lib/media/jao-mpc.el | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'lib/media') diff --git a/lib/media/jao-mpc.el b/lib/media/jao-mpc.el index a86795b..5633648 100644 --- a/lib/media/jao-mpc.el +++ b/lib/media/jao-mpc.el @@ -95,8 +95,8 @@ (format "%s%s %s%s%s%s" ;;  (jao--put-face (if (zerop no) "" (format "%02d/%s " no len)) 'jao-themes-f02) - (jao--put-face title 'jao-themes-f00) - (jao--put-face artist 'jao-themes-f01) + (jao--put-face (or title "") 'jao-themes-f00) + (jao--put-face (or artist "") 'jao-themes-f01) (jao--put-face (if composer (format " [%s]" composer) "") 'jao-themes-f01) (jao--put-face (if album (format " (%s)" album) "") 'jao-themes-f11) @@ -235,6 +235,31 @@ (interactive "sURL: ") (jao-mpc--cmd (format "add %s" url))) +;;;###autoload +(defun jao-mpc-add-or-play-url (url &optional play) + "Add the given URL to mpc's playing list, or just play it." + (let ((p (or play (yes-or-no-p (format "Play %s right now?" url))))) + (when p (jao-mpc-clear)) + (jao-mpc-add-url url) + (if p (jao-mpc-play) (message "%s added to mpc queue" url)))) + +(defvar jao-mpc-stream-urls + '(("classic fm" . "http://media-ice.musicradio.com:80/ClassicFMMP3") + ("wcpe" . "http://audio-mp3.ibiblio.org:8000/wcpe.mp3") + ("cinemix" . "http://94.23.51.96:8000") + ("bbc gold" . "http://media-ice.musicradio.com:80/GoldMP3") + ("irish gold" . "http://icecast2.rte.ie/gold"))) + +;; other cinemix: +;; http://209.9.238.4:6022 http://209.9.238.4:6046 + +;;;###autoload +(defun jao-mpc-play-stream () + "Select a predefined stream URL and add or play it in mpc." + (interactive) + (let ((s (completing-read "Stream: " jao-mpc-stream-urls))) + (jao-mpc-add-or-play-url (cdr (assoc s jao-mpc-stream-urls)) t))) + ;;;###autoload (defun jao-mpc-show-albums (&optional port) "Show album list." -- cgit v1.2.3