summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--init.el4
-rw-r--r--lisp/+emms.el46
2 files changed, 48 insertions, 2 deletions
diff --git a/init.el b/init.el index 677fdb5..6d839fd 100644 --- a/init.el +++ b/init.el
@@ -1156,10 +1156,10 @@ See also `crux-reopen-as-root-mode'."
1156 (add-hook 'embark-collect-mode-hook #'consult-preview-at-point-mode)) 1156 (add-hook 'embark-collect-mode-hook #'consult-preview-at-point-mode))
1157 1157
1158(setup (:straight emms) 1158(setup (:straight emms)
1159 (:also-load +emms)
1159 ;; TODO: Definitely need to do more customization here 1160 ;; TODO: Definitely need to do more customization here
1160 (:option emms-source-file-default-directory "~/var/music/" 1161 (:option emms-source-file-default-directory "~/var/music/"
1161 emms-player-mpv-update-metadata t 1162 emms-player-mpv-update-metadata t)
1162 emms-player-mpv-ipc-method 'file)
1163 (require 'emms-setup) 1163 (require 'emms-setup)
1164 (emms-all) 1164 (emms-all)
1165 (emms-default-players) 1165 (emms-default-players)
diff --git a/lisp/+emms.el b/lisp/+emms.el new file mode 100644 index 0000000..403cbff --- /dev/null +++ b/lisp/+emms.el
@@ -0,0 +1,46 @@
1;;; +emms.el --- EMMS customizations -*- lexical-binding: t; -*-
2
3;;; Commentary:
4
5;;; Code:
6
7(require 'emms-player-mpv)
8(require 'el-patch)
9
10;; https://lists.gnu.org/archive/html/emms-help/2022-01/msg00006.html
11(el-patch-feature emms-player-mpv)
12(with-eval-after-load 'emms-player-mpv
13 (el-patch-defun emms-player-mpv-start (track)
14 (setq emms-player-mpv-stopped nil)
15 (emms-player-mpv-proc-playing nil)
16 (let
17 ((track-name (emms-track-get track 'name))
18 (track-is-playlist (memq (emms-track-get track 'type)
19 '(streamlist playlist))))
20 (if (emms-player-mpv-ipc-fifo-p)
21 (progn
22 ;; ipc-stop is to clear any buffered commands
23 (emms-player-mpv-ipc-stop)
24 (emms-player-mpv-proc-init (if track-is-playlist "--playlist" "--")
25 track-name)
26 (emms-player-started emms-player-mpv))
27 (let*
28 ((play-cmd
29 `(batch
30 ((,(el-patch-swap
31 (if track-is-playlist 'loadlist 'loadfile)
32 'loadfile)
33 ,track-name replace))
34 ((set pause no))))
35 (start-func
36 ;; Try running play-cmd and retry it on connection failure, e.g. if mpv died
37 (apply-partially 'emms-player-mpv-cmd play-cmd
38 (lambda (_mpv-data mpv-error)
39 (when (eq mpv-error 'connection-error)
40 (emms-player-mpv-cmd play-cmd))))))
41 (if emms-player-mpv-ipc-stop-command
42 (setq emms-player-mpv-ipc-stop-command start-func)
43 (funcall start-func)))))))
44
45(provide '+emms)
46;;; +emms.el ends here