stumpwm-devel
[Top][All Lists]
Advanced

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

[STUMP] [PATCH] mpd.lisp return collapse-*-length back


From: Vitaly Mayatskikh
Subject: [STUMP] [PATCH] mpd.lisp return collapse-*-length back
Date: Tue, 21 Oct 2008 00:10:31 +0200
User-agent: Wanderlust/2.15.6 (Almost Unreal) Emacs/23.0 Mule/6.0 (HANACHIRUSATO)

Hi!

*mpd-collapse-album-length* and *mpd-collapse-all-length* still
exist in export, but the code using it was swept away by recent
commit.

diff --git a/contrib/mpd.lisp b/contrib/mpd.lisp
index 09ec699..5635bf8 100644
--- a/contrib/mpd.lisp
+++ b/contrib/mpd.lisp
@@ -306,6 +306,29 @@
 (defun mpd-get-track ()
   (assoc-value :track *mpd-current-song*))
 
+(defun mpd-get-song-name ()
+  (let* ((artist (assoc-value :artist *mpd-current-song*))
+        (album (assoc-value :album *mpd-current-song*))
+        (title (assoc-value :title *mpd-current-song*))
+         (file (assoc-value :file *mpd-current-song*))
+         (song (if (or (null artist)
+                      (null album)
+                      (null title))
+                  (format nil "~a" file)
+                   (format nil "~a \"~a\" - ~a"
+                          artist
+                          (if (and *mpd-collapse-album-length*
+                                   (> (length album) 
*mpd-collapse-album-length*))
+                              (concatenate 'string
+                                           (subseq album 0 
*mpd-collapse-album-length*)
+                                           "...")
+                              album)
+                          title))))
+    (if (and *mpd-collapse-all-length*
+            (> (length song) *mpd-collapse-all-length*))
+        (concatenate 'string (subseq song 0 *mpd-collapse-all-length*) "...")
+       song)))
+
 (defun mpd-modeline (ml)
   (declare (ignore ml))
   (if *mpd-socket*
@@ -333,7 +356,8 @@
     (#\S mpd-get-status)
     (#\t mpd-get-title)
     (#\T mpd-get-track)
-    (#\v mpd-get-volume)))
+    (#\v mpd-get-volume)
+    (#\m mpd-get-song-name)))
 
 (defvar *mpd-current-song-fmt* "%a
 %A
--
wbr, Vitaly




reply via email to

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