diff options
author | jao <jao@gnu.org> | 2020-10-25 01:25:18 +0000 |
---|---|---|
committer | jao <jao@gnu.org> | 2020-10-25 01:25:18 +0000 |
commit | 43f6cae85b24d0c986ab1ed45d399ef010ea1f4b (patch) | |
tree | 0f41ffad1bf715e1f7c3317471d82a23987e5bed | |
parent | a6b0ff6304ee71d4148ec86ed726f5be56f70fe9 (diff) | |
download | elibs-43f6cae85b24d0c986ab1ed45d399ef010ea1f4b.tar.gz elibs-43f6cae85b24d0c986ab1ed45d399ef010ea1f4b.tar.bz2 |
fixes for emms track info in minibuffer
-rw-r--r-- | emms/jao-emms-info-track.el | 14 |
1 files changed, 10 insertions, 4 deletions
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 |