diff options
author | Damien Elmes <emms@repose.cx> | 2006-06-16 15:32:00 +0000 |
---|---|---|
committer | Damien Elmes <emms@repose.cx> | 2006-06-16 15:32:00 +0000 |
commit | 5f68d4a7e7d38db5d53b3d5cbfc4d363377c91e1 (patch) | |
tree | 12044c1b7e581104aeffd92ad570c0cec99ae9eb | |
parent | 22095d1a142dade2382cd811849e4502d975b716 (diff) |
browser: put track number first (better for compilation albums)
darcs-hash:20060616153258-4e3e3-6ac627d571ef0623a346b8806c099f0d2c786ee5.gz
-rw-r--r-- | emms-browser.el | 47 |
1 files changed, 26 insertions, 21 deletions
diff --git a/emms-browser.el b/emms-browser.el index 9bbc645..4e988bd 100644 --- a/emms-browser.el +++ b/emms-browser.el @@ -420,22 +420,25 @@ This uses `emms-browser-make-name-function'" (defun emms-browser-make-name-standard (entry type) "Add track numbers to track names. Apart from tracks, names are displayed without modification." + (let ((key (car entry)) + (track (cadr entry))) (if (eq type 'info-title) - (emms-browser-make-name-with-track-number (cadr entry)) - (car entry))) - -(defun emms-browser-make-name-with-track-number (track) - "Concat a track number to the name of track, if one exists." + (concat (emms-browser-track-number track) + (emms-track-get track 'info-title)) + key))) + +(defun emms-browser-track-number (track) + "Return a string representation of a track number. +The string will end in a space. If no track number is available, +return an empty string." (let ((tracknum (emms-track-get track 'info-tracknumber))) - (concat - (if (or (not (stringp tracknum)) (string= tracknum "0")) - "" - (concat - (if (eq (length tracknum) 1) - (concat "0" tracknum) - tracknum) - ". ")) - (emms-track-get track 'info-title)))) + (if (or (not (stringp tracknum)) (string= tracknum "0")) + "" + (concat + (if (eq (length tracknum) 1) + (concat "0" tracknum) + tracknum) + ". ")))) (defun emms-browser-make-bdata (data name type level) "Return a browser data item from ALIST. @@ -745,13 +748,15 @@ LEVEL is used to control indentation." (if (not (eq type 'info-title)) (emms-browser-add-bdata-to-playlist item starting-level) ;; add full track name as there may not be enough context - (setq name (concat (emms-track-get item 'info-artist) - " - " - ;; track numbers don't make much sense - ;; for individual files - (or (and (> level 1) - name) - (emms-track-get item 'info-title)))) + (setq name (concat + ;; place the track number first - this looks + ;; better for multi-artist albums especially. + (or (and (> level 1) + (emms-browser-track-number item)) + "") + (emms-track-get item 'info-artist) + " - " + (emms-track-get item 'info-title))) (emms-browser-insert-track item name level))))) |