6

In the Emacs Multi-Media System, shuffling by song is as easy as M-xemms-shuffle, but i cant figure out how to shuffle by album, or to add a random album to the playlist. Is this possible?

François Févotte
  • 5,917
  • 1
  • 24
  • 37
  • I don't think that's a feature (yet), but it seems like it could be fairly straightforward to adapt the code from `emms-shuffle` to get that behavior. – Dan Mar 12 '15 at 13:46

2 Answers2

2

Here is an extremely crude function that will play a random album in EMMS.

(defun emms-play-random-album ()
  (interactive)
  (emms-browse-by-album)
  (goto-random-line)
  (emms-browser-add-tracks-and-play))

It depends on functions posted to the Emacs Wiki by sburke@cpan.org.

(defun goto-random-line ()
  "Go to a random line in this buffer."
  ; good for electrobibliomancy.
  (interactive)
  (goto-line (1+ (random (buffer-line-count)))))

(defun buffer-line-count () 
  "Return the number of lines in this buffer."
  (count-lines (point-min) (point-max))) 

I'm making this answer a community wiki as I'm sure it could be improved on.

Brian Z
  • 2,863
  • 16
  • 22
1

If calling an external Python script is not a problem, then give Albumbler a try. The website lists EMMS support as "untested", and I haven't had the chance to try it myself, but it might work for you.

Brian Z
  • 2,863
  • 16
  • 22
  • 1
    it does seem to essentially work, but album art is not displayed in the playlist buffer as it typically would be if you added it manually. – Plutonium Overcast Mar 14 '15 at 22:24