emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/listen ee88cbf3d9 01/12: Add: (listen-format-seconds)


From: ELPA Syncer
Subject: [elpa] externals/listen ee88cbf3d9 01/12: Add: (listen-format-seconds)
Date: Thu, 29 Feb 2024 12:58:31 -0500 (EST)

branch: externals/listen
commit ee88cbf3d969e6fc958631db3d0587889c64ae50
Author: Adam Porter <adam@alphapapa.net>
Commit: Adam Porter <adam@alphapapa.net>

    Add: (listen-format-seconds)
---
 listen-lib.el |  4 ++++
 listen.el     | 12 +++++-------
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/listen-lib.el b/listen-lib.el
index 2afd109a1a..9b21af2591 100644
--- a/listen-lib.el
+++ b/listen-lib.el
@@ -77,6 +77,10 @@
   (or listen-player
       (setf listen-player (make-listen-player-vlc))))
 
+(defun listen-format-seconds (seconds)
+  "Return SECONDS formatted as an hour:minute:second-style duration."
+  (format-seconds "%h:%z%.2m:%.2s" seconds))
+
 ;;;; Methods
 
 (cl-defmethod listen--running-p ((player listen-player))
diff --git a/listen.el b/listen.el
index afcc1407c2..b30bfc5bd3 100755
--- a/listen.el
+++ b/listen.el
@@ -195,9 +195,7 @@ command with completion."
 
 (defun listen-mode-lighter ()
   "Return lighter for `listen-mode'."
-  (cl-labels ((format-time (seconds)
-                (format-seconds "%h:%z%.2m:%.2s" seconds))
-              (format-track ()
+  (cl-labels ((format-track ()
                 (when-let ((info (listen--info listen-player))
                            ;; Sometimes when paused/stopped, the artist and/or
                            ;; title are nil even if info isn't, so we must
@@ -218,11 +216,11 @@ command with completion."
                (list (format-status) " " (format-track)
                      " ("
                      (pcase listen-lighter-format
-                       ('remaining (concat "-" (format-time (- (listen--length 
listen-player)
-                                                               
(listen--elapsed listen-player)))))
-                       (_ (concat (format-time (listen--elapsed listen-player))
+                       ('remaining (concat "-" (listen-format-seconds (- 
(listen--length listen-player)
+                                                                         
(listen--elapsed listen-player)))))
+                       (_ (concat (listen-format-seconds (listen--elapsed 
listen-player))
                                   "/"
-                                  (format-time (listen--length 
listen-player)))))
+                                  (listen-format-seconds (listen--length 
listen-player)))))
                      ") ")
              '("■ ")))))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]