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 --- lib/media/jao-mpris.el | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'lib/media') 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