summaryrefslogtreecommitdiffhomepage
path: root/lib/media
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2021-04-19 04:12:34 +0100
committerjao <jao@gnu.org>2021-04-19 04:12:34 +0100
commita35f2a7ccabb764beeb841196c7d2a13ce093f81 (patch)
tree47084cb9432b1833a8d4a3ba17f42257ff9df69d /lib/media
parent02c12827e4dc38579ee6a1d895fecca14fbfb37e (diff)
downloadelibs-a35f2a7ccabb764beeb841196c7d2a13ce093f81.tar.gz
elibs-a35f2a7ccabb764beeb841196c7d2a13ce093f81.tar.bz2
clean-up emms echo when it's a title-less url
Diffstat (limited to 'lib/media')
-rw-r--r--lib/media/jao-emms-info-track.el13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/media/jao-emms-info-track.el b/lib/media/jao-emms-info-track.el
index ac9fa74..d848145 100644
--- a/lib/media/jao-emms-info-track.el
+++ b/lib/media/jao-emms-info-track.el
@@ -54,11 +54,14 @@
(defun jao-emms-info-track-stream (track)
"Return track info for streams"
- (let ((name (emms-track-name track))
- (title (or (emms-track-get track 'title nil)
- (car (emms-track-get track 'metadata nil))
- (car (split-string (shell-command-to-string "mpc status")
- "\n")))))
+ (let* ((name (emms-track-name track))
+ (title (or (emms-track-get track 'title nil)
+ (car (emms-track-get track 'metadata nil))
+ (car (split-string (shell-command-to-string "mpc status")
+ "\n"))))
+ (title (if (string-match "https?://\\([^/]+\\)/.+" (or title ""))
+ (match-string 1 title)
+ title)))
(format " %s (%s)" (or title "") (if title (emms-track-type track) name))))
(defsubst jao--put-face (str face)