summaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/media/espotify.org17
-rw-r--r--lib/media/jao-mpris.el14
2 files changed, 28 insertions, 3 deletions
diff --git a/lib/media/espotify.org b/lib/media/espotify.org
index 93338a9..98530a8 100644
--- a/lib/media/espotify.org
+++ b/lib/media/espotify.org
@@ -271,6 +271,23 @@ Let's start with an umbrella customization group:
(espotify-call-spotify-via-dbus "OpenUri" uri))
#+end_src
+ Although we're not going to use them explicitly below, we can define
+ a couple more commands that may come in handy:
+
+ #+begin_src emacs-lisp
+ (defun espotify-play-pause ()
+ (interactive)
+ (espotify-call-spotify-via-dbus "PlayPause"))
+
+ (defun espotify-next ()
+ (interactive)
+ (espotify-call-spotify-via-dbus "Next"))
+
+ (defun espotify-previous ()
+ (interactive)
+ (espotify-call-spotify-via-dbus "Previous"))
+ #+end_src
+
* Search front-end using consult
:PROPERTIES:
:header-args: :tangle espotify-consult.el
diff --git a/lib/media/jao-mpris.el b/lib/media/jao-mpris.el
index ad4b452..5551f03 100644
--- a/lib/media/jao-mpris.el
+++ b/lib/media/jao-mpris.el
@@ -49,8 +49,14 @@
"{{album}}"
"{{duration(mpris:length)}}")
sep))
- (m (jao-mpris--playerctl "metadata" "--format" fmt)))
- (split-string (car (split-string m "\n")) sep)))
+ (m (jao-mpris--playerctl "metadata" "--format" fmt))
+ (e (split-string (car (split-string m "\n")) sep)))
+ `((status . ,(car e))
+ (track . ,(cadr e))
+ (title . ,(caddr e))
+ (artist . ,(cadddr e))
+ (album . ,(elt e 4))
+ (duration . ,(last e)))))
;;;###autoload
(defun jao-mpris-status-times ()
@@ -72,7 +78,9 @@
(track (jao-mpris--get 'track info))
(album (jao-mpris--get 'album info))
(len (jao-mpris--get 'length info))
- (duration (cond ((stringp len) len)
+ (duration (jao-mpris--get 'duration info))
+ (duration (cond (duration duration)
+ ((stringp len) len)
((numberp len) (jao-emms--fmt-time (/ len 1e6) "")))))
(format " %s %s %s%s%s"
(jao--put-face (format "%s" (or track "")) 'jao-emms-font-lock-track)