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

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

[elpa] externals/emms 732fa2b0a1: * emms.el: new function `emms-playlist


From: ELPA Syncer
Subject: [elpa] externals/emms 732fa2b0a1: * emms.el: new function `emms-playlist-length'.
Date: Fri, 22 Nov 2024 18:58:05 -0500 (EST)

branch: externals/emms
commit 732fa2b0a12c6a2e3d894fd9cbaccc2aa194fde6
Author: yrk <yrk@gnu.org>
Commit: yrk <yrk@gnu.org>

    * emms.el: new function `emms-playlist-length'.
    
    Displays the total playing time of the current playlist. Aliased as
    `emms-playlist-total-playing-time'.
---
 emms.el | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/emms.el b/emms.el
index 66813b2129..e8781c3c06 100644
--- a/emms.el
+++ b/emms.el
@@ -1312,6 +1312,22 @@ ignore this."
   (ignore track) ;; explicit ignore
   t)
 
+(defun emms-playlist-length ()
+  "Display the total playing time of the current playlist."
+  (interactive)
+  (let ((acc 0))
+    (with-current-emms-playlist
+      (goto-char (point-min))
+      (emms-walk-tracks
+       (setq acc (+ acc (emms-track-get (emms-playlist-track-at (point)) 
'info-playing-time)))))
+    (let ((minutes (/ acc 60))
+          (seconds (% acc 60)))
+      (message (if (>= minutes 60)
+                  (format "%d:%02d:%02d" (/ minutes 60) (% minutes 60) seconds)
+                (format "%02d:%02d" minutes seconds))))))
+
+(defalias 'emms-playlist-total-playing-time 'emms-playlist-length)
+
 
 ;;; ------------------------------------------------------------------
 ;;; Helper functions



reply via email to

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