EMMS: Match playlist format with browser->playlist format
parent
23bf737c8b
commit
1c91e51729
|
@ -105,4 +105,42 @@ is currently playing."
|
|||
"%n"))
|
||||
(setq emms-browser-info-title-format 'ambrevar/emms-browser-track-artist-and-title-format)
|
||||
|
||||
(defun ambrevar/emms-time-for-display (track)
|
||||
"Inspired by `emms-playing-time-display'."
|
||||
(let* ((total-playing-time
|
||||
(or (emms-track-get
|
||||
track
|
||||
'info-playing-time)
|
||||
0))
|
||||
(total-min-only (/ total-playing-time 60))
|
||||
(total-sec-only (% total-playing-time 60)))
|
||||
(format "%02d:%02d" total-min-only total-sec-only)))
|
||||
|
||||
(defun ambrevar/emms-track-description-with-album (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)
|
||||
(cl-flet ((fmt (string &optional suffix prefix)
|
||||
(if string
|
||||
(concat prefix string suffix)
|
||||
"")))
|
||||
(concat
|
||||
(fmt (emms-track-get track 'info-artist) " - ")
|
||||
(fmt (emms-track-get track 'info-album) " - ")
|
||||
(fmt (emms-track-get track 'info-discnumber) "/")
|
||||
(if (emms-track-get track 'info-tracknumber)
|
||||
(format "%02d. " (string-to-number (emms-track-get track 'info-tracknumber)))
|
||||
"")
|
||||
(emms-track-get track 'info-title)
|
||||
(fmt (ambrevar/emms-time-for-display track) "]" " ["))))
|
||||
((eq 'url type)
|
||||
(emms-format-url-track-name (emms-track-name track)))
|
||||
(t (concat (symbol-name type)
|
||||
": " (emms-track-name track))))))
|
||||
(setq emms-track-description-function 'ambrevar/emms-track-description-with-album)
|
||||
|
||||
(provide 'init-emms)
|
||||
|
|
Loading…
Reference in New Issue