Skip to content

Commit

Permalink
embark: add action to add track to arbitrary playlist
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugo-Heagren committed Dec 22, 2021
1 parent baa3842 commit d17b4e7
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions consult-emms-embark.el
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,22 @@
(require 'consult-emms)
(require 'embark)

;;;; Tracks

(defun consult-emms-embark--add-track-playlist (track-name)
"Choose an EMMS playlist to add track TRACK-NAME to."
(let* ((key (get-text-property 0 'consult-emms-track-key track-name))
(track (gethash key emms-cache-db))
(file (assoc-default 'name track nil nil))
(emms-playlist-buffer (consult-emms--choose-buffer)))
(emms-add-file file)))

(embark-define-keymap consult-emms-embark-track-actions
"Keymap for actions on tracks in `consult-emms'."
("p" '("Add to playlist" . consult-emms-embark--add-track-playlist)))

(add-to-list 'embark-keymap-alist '(track . consult-emms-embark-track-actions))

(provide 'consult-emms-embark)

;;; consult-emms-embark.el ends here

0 comments on commit d17b4e7

Please sign in to comment.