From 963010890b497f9eabfb2738ee50734a1befa539 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Thu, 22 Jun 2006 11:27:00 +0000 Subject: browser: use the filename if no useful metadata is available darcs-hash:20060622112720-4e3e3-7067174f9a1f6013bbfecb73e8effc03fdce5d52.gz --- emms-browser.el | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/emms-browser.el b/emms-browser.el index 9c9ca31..5714352 100644 --- a/emms-browser.el +++ b/emms-browser.el @@ -433,14 +433,17 @@ This uses `emms-browser-make-name-function'" Individual tracks are in the form 'tracknum. artist - title' Albums are in the form '(year) album'." (let ((key (car entry)) - (track (cadr entry))) ;; only the first track + (track (cadr entry)) + artist title) ;; only the first track (cond ((eq type 'info-title) - (concat (emms-browser-track-number track) - (emms-track-get track 'info-artist) - " - " - (emms-track-get track 'info-title))) - ((eq type 'info-album) + (setq artist (emms-track-get track 'info-artist)) + (setq title (emms-track-get track 'info-title)) + (if (not (and artist title)) + key + (concat (emms-browser-track-number track) + artist " - " title))) + ((eq type 'info-album) (concat (emms-browser-year-number track) key)) (t key)))) @@ -481,13 +484,16 @@ LEVEL is the number of the sublevel the db item will be placed in." (defun emms-browser-make-alist (type tracks) "Make an alist mapping of TYPE -> TRACKS. Items with no metadata for TYPE will be placed in 'misc'" - (let (db key existing) + (let (db key existing tracknum) (dolist (track tracks) (setq key (emms-track-get track type "misc")) (when (eq type 'info-title) ;; try and make every track unique - (setq key (concat (emms-browser-track-number track) - key))) + (setq tracknum (emms-browser-track-number track)) + (if (string= tracknum "") + (setq key (file-name-nondirectory + (emms-track-get track 'name))) + (setq key (concat tracknum key)))) (setq existing (assoc key db)) (if existing (setcdr existing (cons track (cdr existing))) -- cgit v1.2.3