summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2020-11-01 02:13:43 +0000
committerjao <jao@gnu.org>2020-11-01 02:13:43 +0000
commit667b7b842d60ac2aa5f371883c4fd495ea6ac99f (patch)
tree785767fea4be3102e9baca150135140705f2abbc
parentb7d2cd9b5bda2c322ea5333913f17fe5c46f8566 (diff)
downloadelibs-667b7b842d60ac2aa5f371883c4fd495ea6ac99f.tar.gz
elibs-667b7b842d60ac2aa5f371883c4fd495ea6ac99f.tar.bz2
tweaks to emms track info
-rw-r--r--emms/jao-emms-info-track.el30
1 files changed, 20 insertions, 10 deletions
diff --git a/emms/jao-emms-info-track.el b/emms/jao-emms-info-track.el
index f1d922d..ea3513e 100644
--- a/emms/jao-emms-info-track.el
+++ b/emms/jao-emms-info-track.el
@@ -71,7 +71,17 @@
(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) ""))
+ (if x (format "%02d:%02d%s" (/ x 60) (mod x 60) (or suffix "")) ""))
+
+(defun jao-emms--fmt-song-times (track lapsed pre post)
+ (if lapsed
+ (let ((time (when track (emms-track-get track 'info-playing-time))))
+ (format "%s%s%s%s"
+ (or pre "")
+ (jao-emms--fmt-time lapsed (when time "/"))
+ (jao-emms--fmt-time time "")
+ (or post "")))
+ ""))
(defun jao-emms-info-track-file (track &optional lapsed plen titlesep)
"Return a description of the current track."
@@ -94,11 +104,7 @@
(jao--put-face title
'jao-emms-font-lock-title)
(or titlesep " ")
- (if lapsed
- (format "[%s%s] "
- (jao-emms--fmt-time lapsed "/")
- (jao-emms--fmt-time time ""))
- "")
+ (jao-emms--fmt-song-times track lapsed "[" "] ")
(jao--put-face artist 'jao-emms-font-lock-artist)
(jao--put-face (if composer (format " [%s]" composer) "")
'jao-emms-font-lock-artist)
@@ -160,12 +166,16 @@
(info-note . "c")))))
(defvar jao-emms-echo-string "")
-(defun jao-emms-update-echo-string (&optional track)
- (if (and emms-player-playing-p (not emms-player-paused-p))
+(defun jao-emms-update-echo-string (&optional existing-track)
+ (if emms-player-playing-p
(jao-emms--with-mpd-track
- (lambda (track _ play-len)
+ (lambda (track lapsed play-len)
(setq jao-emms-echo-string
- (jao-emms-info-track-description track nil play-len))
+ (if emms-player-paused-p
+ (if existing-track
+ (jao-emms--fmt-song-times existing-track lapsed "(" ")")
+ "ยง")
+ (jao-emms-info-track-description track nil play-len)))
(jao-minibuffer-refresh)))
(setq jao-emms-echo-string "")
(jao-minibuffer-refresh)))