diff options
| -rw-r--r-- | doc/emms.texinfo | 6 | ||||
| -rw-r--r-- | lisp/emms-browser.el | 28 | 
2 files changed, 32 insertions, 2 deletions
diff --git a/doc/emms.texinfo b/doc/emms.texinfo index 863e236..d18ce6b 100644 --- a/doc/emms.texinfo +++ b/doc/emms.texinfo @@ -1726,6 +1726,12 @@ artist->album->track when you switch to the 'singles' filter:  (add-hook 'emms-browser-filter-changed-hook 'toggle-album-display)  @end lisp +Furthermore, you can customize +@var{emms-browser-get-track-field-function} to choose which the metadata +fields used for the different tree nodes (@code{'info-artist}, +@code{info-year}, etc.).  For instance, you can choose whether to +organize the tree by artist, album artist or performer. +  @subheading Changing Display Format  Format strings govern the way items are displayed in the browser and diff --git a/lisp/emms-browser.el b/lisp/emms-browser.el index 0ff8a4f..4079181 100644 --- a/lisp/emms-browser.el +++ b/lisp/emms-browser.el @@ -319,7 +319,7 @@ are displayed. It is called with two arguments - track and type."    :type 'function)  (defcustom emms-browser-get-track-field-function -  'emms-browser-get-track-field-simple +  'emms-browser-get-track-field-albumartist    "*A function to get an element from a track.  Change this to customize the way data is organized in the  browser. For example, @@ -328,7 +328,9 @@ directory name to determine the artist. This means that  soundtracks, compilations and so on don't populate the artist  view with lots of 1-track elements."    :group 'emms-browser -  :type 'function) +  :type '(choice (function :tag "Simple" 'emms-browser-get-track-field-simple) +                 (function :tag "Albumartist-sorting" 'emms-browser-get-track-field-albumartist) +                 (function :tag "Other")))  (defcustom emms-browser-covers    '("cover_small" "cover_med" "cover_large") @@ -645,8 +647,30 @@ compilations, etc."    (funcall emms-browser-get-track-field-function track type))  (defun emms-browser-get-track-field-simple (track type) +  "Return TYPE from TRACK without any heuristic. +This function can be used as +`emms-browser-get-track-field-function'."    (emms-track-get track type "misc")) +(defun emms-browser-get-track-field-albumartist (track type) +  "Return TYPE from TRACK with an albumartist-oriented heuristic. +For 'info-artist TYPE, use 'info-albumartistsort, 'info-albumartist, +'info-artistsort. +For 'info-year TYPE, use 'info-originalyear, 'info-originaldate and +'info-date symbols." +  (cond ((eq type 'info-artist) +         (or (emms-track-get track 'info-albumartistsort) +             (emms-track-get track 'info-albumartist) +             (emms-track-get track 'info-artistsort) +             (emms-track-get track 'info-artist "<unknown artist>"))) +        ((eq type 'info-year) +         (let ((date (or (emms-track-get track 'info-originaldate) +                         (emms-track-get track 'info-originalyear) +                         (emms-track-get track 'info-date) +                         (emms-track-get track 'info-year "<unknown year>")))) +           (emms-format-date-to-year date))) +        (t (emms-track-get track type "misc")))) +  (defun emms-browser-get-track-field-use-directory-name (track type)    (if (eq type 'info-artist)        (emms-browser-get-artist-from-path  | 
