summaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2022-03-15 00:03:29 +0000
committerjao <jao@gnu.org>2022-03-15 00:03:29 +0000
commiteb6a935a51538ad646a9ef65aab4c4d3cc35e0f3 (patch)
treebcfd6e316cdb0b143068876643a44b2d1fa05cc4 /lib
parent2c842addd4ab7ef3fd6f54399d48732027fcbe5b (diff)
downloadelibs-eb6a935a51538ad646a9ef65aab4c4d3cc35e0f3.tar.gz
elibs-eb6a935a51538ad646a9ef65aab4c4d3cc35e0f3.tar.bz2
mpris: more flexible notification parser
Diffstat (limited to 'lib')
-rw-r--r--lib/media/jao-mpris.el10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/media/jao-mpris.el b/lib/media/jao-mpris.el
index 4df83c7..63a5aae 100644
--- a/lib/media/jao-mpris.el
+++ b/lib/media/jao-mpris.el
@@ -91,7 +91,8 @@
(defvar jao-mpris-track-string "")
(defun jao-mpris--get (k &optional l)
- (alist-get k (or l jao-mpris--current)))
+ (when-let (v (alist-get k (or l jao-mpris--current)))
+ (if (consp v) (car v) v)))
(defun jao-mpris--set-current (k v)
(when v (setf (alist-get k jao-mpris--current "" t) v)))
@@ -116,9 +117,10 @@
(jao--put-face (format "%s" (or track "")) 'jao-themes-f00)
(jao--put-face (or title "") 'jao-themes-f01)
(jao--put-face (or artist "") 'jao-themes-f11)
- (jao--put-face (if album (format " (%s)" album) "")
+ (jao--put-face (if (and album (not (string-blank-p album)))
+ (format " (%s)" album) "")
'jao-themes-f01)
- (if duration (format " %s" duration) ""))))
+ (if duration (format " - %s" duration) ""))))
(defun jao-mpris--track (&optional info)
(let ((info (or info (jao-playerctl--status))))
@@ -153,7 +155,7 @@
(when-let (md (caadr (assoc "Metadata" properties)))
(let ((tno (caadr (assoc "xesam:trackNumber" md)))
(tlt (caadr (assoc "xesam:title" md)))
- (art (caaadr (assoc "xesam:artist" md)))
+ (art (caadr (assoc "xesam:artist" md)))
(alb (caadr (assoc "xesam:album" md)))
(len (caadr (assoc "mpris:length" md))))
(jao-mpris--set-current 'track tno)