From f1d177c63964f5cf9bf65093461a43772dbf5a27 Mon Sep 17 00:00:00 2001 From: jao Date: Wed, 2 Jun 2021 02:07:12 +0100 Subject: mpris: drop dep on jao-emms, and not needed in minibuffer --- init.org | 7 +------ lib/media/jao-mpris.el | 17 ++++++++++------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/init.org b/init.org index f516712..f5008f6 100644 --- a/init.org +++ b/init.org @@ -2924,12 +2924,7 @@ #+end_src *** mpris #+begin_src emacs-lisp - (use-package jao-mpris - :config - (jao-mpris-minibuffer-order 50) - (dolist (name '("spotifyd" "spotify" "mopidy")) - (jao-mpris-minibuffer-register name) - (jao-mpris-minibuffer-register name :system))) + (use-package jao-mpris) #+end_src *** spotify Access to spotify uses packages tangled from [[./lib/media/espotify.org][espotify.org]], which diff --git a/lib/media/jao-mpris.el b/lib/media/jao-mpris.el index 597eb94..36cde05 100644 --- a/lib/media/jao-mpris.el +++ b/lib/media/jao-mpris.el @@ -25,8 +25,8 @@ ;;; Code: (require 'dbus) +(require 'jao-themes) (require 'jao-minibuffer) -(require 'jao-emms-info-track) (defun jao-mpris--playerctl (&rest args) (shell-command-to-string (format "playerctl %s" @@ -72,6 +72,9 @@ (defun jao-mpris--get (k &optional l) (alist-get k (or l jao-mpris--current))) +(defun jao-mpris--fmt-time (x suffix) + (if x (format "%02d:%02d%s" (/ x 60) (mod x 60) (or suffix "")) "")) + (defun jao-mpris--format (&optional info) (let* ((artist (jao-mpris--get 'artist info)) (title (jao-mpris--get 'title info)) @@ -81,13 +84,13 @@ (duration (jao-mpris--get 'duration info)) (duration (cond (duration duration) ((stringp len) len) - ((numberp len) (jao-emms--fmt-time (/ len 1e6) ""))))) + ((numberp len) (jao-mpris--fmt-time (/ len 1e6) ""))))) (format " %s %s %s%s%s" - (jao--put-face (format "%s" (or track "")) 'jao-emms-font-lock-track) - (jao--put-face title 'jao-emms-font-lock-title) - (jao--put-face artist 'jao-emms-font-lock-artist) + (jao--put-face (format "%s" (or track "")) 'jao-themes-f00) + (jao--put-face title 'jao-themes-f01) + (jao--put-face artist 'jao-themes-f11) (jao--put-face (if album (format " (%s)" album) "") - 'jao-emms-font-lock-album) + 'jao-themes-f01) (if duration (format " [%s]" duration) "")))) (defun jao-mpris--track (&optional info) @@ -111,7 +114,7 @@ (defun jao-mpris-minibuffer-order (order) (jao-minibuffer-add-msg-variable 'jao-mpris-track-string order)) -(defun jao-mpris--handler (iname properties &rest args) +(defun jao-mpris--handler (_iname properties &rest _args) (when properties (let ((st (caadr (assoc "PlaybackStatus" properties))) (md (caadr (assoc "Metadata" properties)))) -- cgit v1.2.3