summaryrefslogtreecommitdiffhomepage
path: root/lib/media/jao-mpris.el
diff options
context:
space:
mode:
Diffstat (limited to 'lib/media/jao-mpris.el')
-rw-r--r--lib/media/jao-mpris.el19
1 files changed, 11 insertions, 8 deletions
diff --git a/lib/media/jao-mpris.el b/lib/media/jao-mpris.el
index 2537fa8..47a35a7 100644
--- a/lib/media/jao-mpris.el
+++ b/lib/media/jao-mpris.el
@@ -93,7 +93,8 @@
;;;###autoload
(defun jao-mpris-reset ()
(interactive)
- (setq jao-mpris-track-string ""))
+ (setq jao-mpris-track-string ""
+ jao-mpris--current nil))
(defun jao-mpris--get (k &optional l)
(when-let (v (alist-get k (or l jao-mpris--current)))
@@ -154,20 +155,22 @@
(jao-minibuffer-add-msg-variable 'jao-mpris-track-string (- order))
(jao-minibuffer-add-variable 'jao-mpris-track-string order)))
-(defun jao-mpris--handler (_iname properties &rest _args)
+(defun jao-mpris--handler (iname properties &rest _args)
(let ((inhibit-message t))
- (message "Received properties: %S from %s" properties _iname))
+ (message "Received properties: %S from %s" properties iname))
(when-let (md (caadr (assoc "Metadata" properties)))
(let ((tno (caadr (assoc "xesam:trackNumber" md)))
(tlt (caadr (assoc "xesam:title" 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)
- (jao-mpris--set-current 'title tlt)
- (jao-mpris--set-current 'artist art)
- (jao-mpris--set-current 'album alb)
- (jao-mpris--set-current 'length len)))
+ (if (string= (or tlt "") "TIDAL")
+ (jao-mpris-reset)
+ (jao-mpris--set-current 'track tno)
+ (jao-mpris--set-current 'title tlt)
+ (jao-mpris--set-current 'artist art)
+ (jao-mpris--set-current 'album alb)
+ (jao-mpris--set-current 'length len))))
(when-let (st (caadr (assoc "PlaybackStatus" properties)))
(jao-mpris--set-current 'status st)
(when (string= st "Stopped")