From b1f1c4ad7e79f41774f5f135d93c762571c88866 Mon Sep 17 00:00:00 2001 From: Tassilo Horn Date: Wed, 29 Aug 2007 09:35:00 +0000 Subject: fix-browser-covers.dpatch - If emms-browser-covers value is a function, call it with a directory as its docs say. (Before it was called with a file) - Also add to its doc-string that its second arg is a symbol (its size). - Support all image types emacs knows. darcs-hash:20070829093557-c06f4-c69286db575a025baa349ebb042ded3cd78fa5c4.gz --- emms-browser.el | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/emms-browser.el b/emms-browser.el index 171eaaa..48ebc83 100644 --- a/emms-browser.el +++ b/emms-browser.el @@ -333,8 +333,9 @@ view with lots of 1-track elements." '("cover_small.jpg" "cover_med.jpg" "cover_large.jpg") "*Control how cover images are found. Can be either a list of small, medium and large images (large -currently not used), a function which takes a directory, and should -return a path to the cover, or nil to turn off cover loading." +currently not used), a function which takes a directory and one +of the symbols `small', `medium' or `large', and should return a +path to the cover, or nil to turn off cover loading." :group 'emms-browser :type '(choice list function boolean)) @@ -1591,7 +1592,7 @@ included." (cover (cond ((functionp emms-browser-covers) - (funcall emms-browser-covers path size)) + (funcall emms-browser-covers (file-name-directory path) size)) ((and (listp emms-browser-covers) (nth size-idx emms-browser-covers)) (concat (file-name-directory path) @@ -1607,12 +1608,23 @@ included." (insert (emms-browser-make-cover path))) (defun emms-browser-make-cover (path) - (emms-propertize " " - 'display `(image - :type jpeg - :margin 5 - :file ,path) - 'rear-nonsticky '(display))) + (let* ((ext (file-name-extension path)) + (type (cond + ((string= ext "png") 'png) + ((string= ext "xbm") 'xbm) + ((string= ext "xpm") 'xpm) + ((string= ext "pbm") 'pbm) + ((string-match "e?ps" + ext) 'postscript) + ((string= ext "gif") 'gif) + ((string= ext "tiff") 'tiff) + (t 'jpeg)))) + (emms-propertize " " + 'display `(image + :type ,type + :margin 5 + :file ,path) + 'rear-nonsticky '(display)))) (defun emms-browser-get-cover-str (path size) (let ((cover (emms-browser-get-cover-from-path path size))) -- cgit v1.2.3