From 43f6cae85b24d0c986ab1ed45d399ef010ea1f4b Mon Sep 17 00:00:00 2001 From: jao Date: Sun, 25 Oct 2020 01:25:18 +0000 Subject: fixes for emms track info in minibuffer --- emms/jao-emms-info-track.el | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'emms/jao-emms-info-track.el') diff --git a/emms/jao-emms-info-track.el b/emms/jao-emms-info-track.el index f0cdd0f..d2157be 100644 --- a/emms/jao-emms-info-track.el +++ b/emms/jao-emms-info-track.el @@ -69,6 +69,9 @@ (string-match "\\`\\(:?[0-9]+\\)" x) (string-to-number (match-string 1 x))))) +(defun jao-emms--fmt-time (x suffix) + (if x (format "%02d:%02d%s" (/ x 60) (mod x 60) suffix) "")) + (defun jao-emms-info-track-file (track &optional lapsed plen titlesep) "Return a description of the current track." (let ((no (jao-emms--to-number (emms-track-get track 'info-tracknumber "0"))) @@ -82,9 +85,12 @@ (playlength (if plen (format "/%02d" (string-to-number plen)) ""))) (if (or (not title) (not album)) (emms-track-simple-description track) - (format "♪ [%s%s] %s%s%s%s%s%s" - (if lapsed (format "%02d:%02d/" (/ lapsed 60) (mod lapsed 60)) "") - (if time (format "%02d:%02d" (/ time 60) (mod time 60)) "") + (format "♪ %s%s%s%s%s%s%s" + (if lapsed + (format "[%s%s] " + (jao-emms--fmt-time lapsed "/") + (jao-emms--fmt-time time "")) + "") (jao--put-face artist 'jao-emms-font-lock-artist) (jao--put-face (if composer (format " [%s]" composer) "") 'jao-emms-font-lock-artist) @@ -119,7 +125,7 @@ (song (jao-emms--to-number (cdr (assoc "song" st)))) (track (emms-playlist-current-selected-track))) (when (and track song) - (emms-track-set track 'info-tracknumber (1+ song))) + (emms-track-set track 'info-tracknumber (format "%d" (1+ song)))) (funcall callback track lapsed plen))))) ;;;###autoload -- cgit v1.2.3