1

I've been using the Emacs Multi-Media System and it works pretty well, but one thing i can't figure out how to do is sort by AlbumArtist. This is important, because i have many compilation albums and soundtracks.

Is there a way to sort the music browser by AlbumArtist(defaulting to Artist if the file lacks an AlbumArtist tag)? (btw, i am using libtag because the default tag reader didn't work right on some of my files)

1

This post offers a partial solution to your problem. Note that it does not do a sort by AlbumArtist (hence the "partial"), but it does deal with compilation albums in the browser in a sane way.

You will want to modify emms-browser-get-track-field-function, whose doctstring reads:

Documentation:

*A function to get an element from a track. Change this to customize the way data is organized in the browser. For example, emms-browser-get-track-field-use-directory-name uses the 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.

Now, emms-browser-get-track-field-use-directory-name itself is undocumented (a lot of emms is like this, unfortunately). You can either try to use the built-in function as suggested by:

(setq emms-browser-get-track-field-function
      #'emms-browser-get-track-field-use-directory-name)

I found the built-in function unsatisfactory for reasons I can't recall (it's been a while since I looked at the source code). Instead, I rolled my own, which you're free to use/modify as you see fit:

(defun dan-emms-get-artist-from-path (track)
  "Identify artist name from directory name directly below
default directory."
  (let* ((path  (emms-track-get track 'name))
         (base  (expand-file-name emms-source-file-default-directory))
         (trunc (substring path (length base))))
    (car (split-string trunc "/"))))

(defun dan-emms-get-track-field (track type)
  "Sort artists by directory name in EMMS browser (avoids the
compilation albums propagating orphans in the list)."
  (if (eq type 'info-artist)
      (dan-emms-get-artist-from-path track)
    (emms-track-get track type "misc")))

;; make compilations follow from the directory name (no orphans)
(setq emms-browser-get-track-field-function
      #'dan-emms-get-track-field)
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.