aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTassilo Horn <tassilo@member.fsf.org>2007-08-29 09:35:00 +0000
committerTassilo Horn <tassilo@member.fsf.org>2007-08-29 09:35:00 +0000
commitb1f1c4ad7e79f41774f5f135d93c762571c88866 (patch)
tree85637afea84d2f3704be55f440436f417ada90ff
parent46631e0d06139949be31afdf512f0d95929830d9 (diff)
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
-rw-r--r--emms-browser.el30
1 files 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)))