diff options
Diffstat (limited to 'lib/media')
-rw-r--r-- | lib/media/jao-mpc.el | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/media/jao-mpc.el b/lib/media/jao-mpc.el index 6f74243..2ad27a4 100644 --- a/lib/media/jao-mpc.el +++ b/lib/media/jao-mpc.el @@ -251,5 +251,19 @@ (when secondary-port (jao-mpc-connect secondary-port)) (jao-minibuffer-add-msg-variable 'jao-mpc-minibuffer-str 1)) +(defvar jao-mpc--album-titles nil) +(defconst jao-mpc--albums-cmd + "-f '%album% - %artist%' find \"(ALBUM =~ '.*')\" | uniq") + +;;;###autoload +(defun jao-mpc-select-album () + (interactive) + (let ((albums (or jao-mpc--album-titles + (setq jao-mpc--album-titles + (split-string (jao-mpc--cmd jao-mpc--albums-cmd) + "\n" t))))) + (when-let (album (completing-read "Play album: " albums nil t)) + (jao-mpc--add-and-play (car (split-string album "-" t " ")))))) + (provide 'jao-mpc) ;;; jao-mpc.el ends here |