aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathias.dahl <mathias.dahl>2007-12-28 08:59:00 +0000
committermathias.dahl <mwolson@gnu.org>2007-12-28 08:59:00 +0000
commit92370b0ac336b1716614e1daea48f059c372092a (patch)
tree8ca61199cd04cc4bd119c91a021d26b80a0eef52
parente0ca2bbebcf9d51c7450e48e9ce229744b4c60f6 (diff)
Format URL so that it looks nicer in playlist.
darcs-hash:20071228085920-18da9-66f645e44747dcc5ca70958f5fdefc3fd79c0590.gz
-rw-r--r--emms.el17
1 files changed, 17 insertions, 0 deletions
diff --git a/emms.el b/emms.el
index ca618b0..48242a3 100644
--- a/emms.el
+++ b/emms.el
@@ -598,6 +598,23 @@ Otherwise, return the type and the name with a colon in between."
(concat (symbol-name (emms-track-type track))
": " (emms-track-name track))))
+(defun emms-track-simple-description (track)
+ "Simple function to give a user-readable description of a track.
+If it's a file track, just return the file name. Otherwise,
+return the type and the name with a colon in between. Hex-encoded
+characters in URLs are replaced by the decoded character."
+ (let ((type (emms-track-type track)))
+ (cond ((eq 'file type)
+ (emms-track-name track))
+ ((eq 'url type)
+ (emms-format-url-track-name (emms-track-name track)))
+ (t (concat (symbol-name type)
+ ": " (emms-track-name track))))))
+
+(defun emms-format-url-track-name (name)
+ "Format URL track name for better readability."
+ (url-unhex-string name))
+
(defun emms-track-force-description (track)
"Always return text that describes TRACK.
This is used when inserting a description into a buffer.