diff options
-rw-r--r-- | emacs/.emacs.d/init/ycp-emms.el | 3 | ||||
-rw-r--r-- | emacs/.emacs.d/lisp/my/my-emms.el | 10 |
2 files changed, 12 insertions, 1 deletions
diff --git a/emacs/.emacs.d/init/ycp-emms.el b/emacs/.emacs.d/init/ycp-emms.el index d83b53b..a3a4604 100644 --- a/emacs/.emacs.d/init/ycp-emms.el +++ b/emacs/.emacs.d/init/ycp-emms.el @@ -40,7 +40,7 @@ (setq emms-source-playlist-default-format 'native) (setq emms-repeat-playlist t) (my-keybind emms-playlist-mode-map "C-x C-f" #'emms-play-playlist) - (setq emms-player-list '(emms-player-mpv)) + (setq emms-player-list '(emms-player-mpv emms-player-vlc)) (setq emms-player-vlc-parameters '("--intf=qt" "--extraintf=rc")) (setq emms-playlist-buffer-name "*EMMS Playlist*") (setq emms-source-file-directory-tree-function @@ -91,6 +91,7 @@ (add-hook 'emms-playlist-selection-changed-hook 'my-emms-output-current-track-to-i3bar-file) (setq emms-player-next-function 'my-emms-next-track-or-random-album) + (setq emms-players-preference-f 'my-emms-players-preference) (my-keybind dired-mode-map "e" #'my-dired-add-to-emms) (my-override emms-track-simple-description) (my-emms-add-all) diff --git a/emacs/.emacs.d/lisp/my/my-emms.el b/emacs/.emacs.d/lisp/my/my-emms.el index 47758f2..f4e9bc0 100644 --- a/emacs/.emacs.d/lisp/my/my-emms.el +++ b/emacs/.emacs.d/lisp/my/my-emms.el @@ -159,6 +159,16 @@ either 'audio or 'video (alist-get type my-extension-types))) (with-current-buffer to (emms-sort)))) +(defun my-emms-players-preference (track players) + "If audio, use first player, otherwise second." + (let ((name (emms-track-name track))) + (if (and (length> players 1) + (string-prefix-p "file://" name) + (member (file-name-extension name) + '("mkv" "mp4" "ogv" "avi" "webm"))) + (cadr players) + (car players)))) + (defvar my-emms-playlist-alist nil "alist controlling playlists, where the cdr of each item is an also an alist, with possible keys 'source and 'type. |