summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2025-10-05 13:42:59 +0100
committerjao <jao@gnu.org>2025-10-05 13:42:59 +0100
commita8966ff200e963ce40d5e3234e8f9a203f45a421 (patch)
tree0930af7a1331890f5cc19a77b763b64a26b6ce9f
parent59ac10819c46492d82d4aae1388cf0b1b292d1ad (diff)
downloadelibs-a8966ff200e963ce40d5e3234e8f9a203f45a421.tar.gz
elibs-a8966ff200e963ce40d5e3234e8f9a203f45a421.tar.bz2
mpc: notifications also for streamming
-rw-r--r--lib/media/jao-mpc.el16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/media/jao-mpc.el b/lib/media/jao-mpc.el
index 2dfec76..5228787 100644
--- a/lib/media/jao-mpc.el
+++ b/lib/media/jao-mpc.el
@@ -47,11 +47,12 @@
(mapconcat (lambda (f) (format "%s:::%%%s%%" f f)) fields "\n"))
(defconst jao-mpc--fields
- '(artist album composer originaldate genre title track position time name))
+ '(artist album composer originaldate genre title track position time name
+ file))
(defconst jao-mpc--stfmt
(jao-mpc--fformat
- '(artist album composer originaldate genre title track name)))
+ '(artist album composer originaldate genre title track name file)))
(defconst jao-mpc--stfmtt
(jao-mpc--fformat '(currenttime totaltime percenttime songpos length)))
@@ -261,10 +262,13 @@
(defun jao-mpc-notify (&optional port)
(interactive)
(when-let* ((current (jao-mpc--current)))
- (let* ((artist (alist-get 'artist current))
- (title (alist-get 'title current))
- (album (alist-get 'album current))
- (track (alist-get 'track current))
+ (let* ((artist (or (alist-get 'artist current) "Anonymous"))
+ (title (or (alist-get 'title current)
+ (when-let* ((tl (alist-get 'file current)))
+ (file-name-base tl))
+ ""))
+ (album (or (alist-get 'album current) ""))
+ (track (or (alist-get 'track current) ""))
(times (jao-mpc--current-timestr t current)))
(jao-notify (format "%s -- %s" artist times)
(format "%s %s" track title)