emacs-devel
[Top][All Lists]
Advanced

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

[PATCH] Search for more cover image names in MPC


From: Mark Oteiza
Subject: [PATCH] Search for more cover image names in MPC
Date: Sun, 11 Oct 2015 11:18:02 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

* lisp/mpc.el (mpc-format): Also look for .folder.jpg or folder.jpg
case insensitively
---

The downcase isn't necessary, I just thought it would be nice to allow
things cased differently. At least in my library, I seem to have a
handful of capitalized folder images.

 lisp/mpc.el | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/lisp/mpc.el b/lisp/mpc.el
index bc7d473..0178712 100644
--- a/lisp/mpc.el
+++ b/lisp/mpc.el
@@ -44,7 +44,6 @@
 ;; - visual feedback for drag'n'drop
 ;; - display/set `repeat' and `random' state (and maybe also `crossfade').
 ;; - allow multiple *mpc* sessions in the same Emacs to control different mpds.
-;; - look for .folder.png (freedesktop) or folder.jpg (XP) as well.
 ;; - fetch album covers and lyrics from the web?
 ;; - improve MPC-Status: better volume control, add a way to show/hide the
 ;;   rest, plus add the buttons currently in the toolbar.
@@ -1010,7 +1009,11 @@ If PLAYLIST is t or nil or missing, use the main 
playlist."
                                              time)))))
                     (`Cover
                      (let* ((dir (file-name-directory (cdr (assq 'file info))))
-                            (cover (concat dir "cover.jpg"))
+                            (covers '(".folder.png" "cover.jpg" "folder.jpg"))
+                            (cover (cl-flet ((coverp (fn)
+                                               (member (downcase fn) covers)))
+                                     (cl-loop for file in (directory-files dir)
+                                              if (coverp file) return file)))
                             (file (with-demoted-errors "MPC: %s"
                                     (mpc-file-local-copy cover)))
                             image)
-- 
2.6.1





reply via email to

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