[Music] Simplify implementation of ‘db/play-playlist-from-cache’

Use ‘db/-emms-playlist-from-files’ instead of generating the playlist on our
own.
This commit is contained in:
Daniel Borchmann 2019-06-10 09:24:56 +02:00
parent 68d7605deb
commit bd29ca9c02
Signed by: exot
GPG Key ID: 1C7071A75BB72D64

View File

@ -29,21 +29,11 @@ Shuffle it and start playing it afterwards."
(defun db/play-playlist-from-cache () (defun db/play-playlist-from-cache ()
"Start playing songs from `db/playlist" "Start playing songs from `db/playlist"
(interactive) (interactive)
(save-window-excursion (db/-emms-playlist-from-files
(let ((music-buffer-name "*EMMS Playlist* -- Personal")) (->> db/playlist
(unless (get-buffer music-buffer-name) (cl-remove-if-not #'(lambda (track)
(emms-playlist-new music-buffer-name)) (eq (cdr track) :include)))
(with-current-buffer (get-buffer music-buffer-name) (mapcar #'car))))
(emms-stop)
(emms-playlist-set-playlist-buffer)
(emms-playlist-current-clear)
(dolist (track db/playlist)
(when (eq :include (cdr track))
(emms-playlist-current-insert-source 'emms-insert-file (car track))))
(goto-char (point-min))
(emms-shuffle)
(emms-playlist-select-first)
(emms-start)))))
(defun db/play-playlist-from-git-annex-tag (match-expression) (defun db/play-playlist-from-git-annex-tag (match-expression)
"Generate playlist from git annex find on MATCH-EXPRESSION. "Generate playlist from git annex find on MATCH-EXPRESSION.