Emms: Disable "resume on restart".

master
Pierre Neidhardt 2021-05-07 16:02:44 +02:00
parent 9831bf16b9
commit 95633963cd
1 changed files with 21 additions and 18 deletions

View File

@ -33,24 +33,27 @@
;;; Resume on restart.
;;; We don't use bookmarks as that could interfere with user's ones.
(with-eval-after-load 'desktop
(add-to-list 'desktop-globals-to-save 'emms-playing-time)
(when (emms-playlist-current-selected-track)
(let ((time emms-playing-time))
(setq emms-playing-time 0) ; Don't disturb the time display.
(and (memq 'emms-player-mpv emms-player-list)
(executable-find "mpv")
(push "--mute=yes" emms-player-mpv-parameters))
(emms-start)
(sleep-for 0 300) ; This is required for the player might not be ready yet.
;; TODO: This 'sleep-for' is a kludge and upstream should provide a provision for it.
(with-demoted-errors "EMMS error: %S" (emms-player-seek-to time))
(and (memq 'emms-player-mpv emms-player-list)
(executable-find "mpv")
(pop emms-player-mpv-parameters)
;; TODO: Adapt this to new mpv backend when emms 5.1 is out.
(call-process-shell-command (emms-player-mpv--format-command "mute") nil nil nil))
(emms-pause))))
;; TODO: Seems to be quite broken (does not resume at the right time + sometimes
;; remains silent). Anyways, it's not so useful, remove?
;; (with-eval-after-load 'desktop
;; (add-to-list 'desktop-globals-to-save 'emms-playing-time)
;; (when (emms-playlist-current-selected-track)
;; (let ((time emms-playing-time))
;; (setq emms-playing-time 0) ; Don't disturb the time display.
;; (and (memq 'emms-player-mpv emms-player-list)
;; (executable-find "mpv")
;; (push "--mute=yes" emms-player-mpv-parameters))
;; (emms-start)
;; (sleep-for 0 300) ; This is required for the player might not be ready yet.
;; ;; TODO: This 'sleep-for' is a kludge and upstream should provide a provision for it.
;; (with-demoted-errors "EMMS error: %S" (emms-player-seek-to time))
;; (and (memq 'emms-player-mpv emms-player-list)
;; (executable-find "mpv")
;; (pop emms-player-mpv-parameters)
;; ;; TODO: Adapt this to new mpv backend when emms 5.1 is out.
;; (call-process-shell-command (emms-player-mpv--format-command "mute") nil nil nil))
;; (emms-pause))))
(when (require 'helm-emms nil t)
(setq helm-emms-dired-directories (list emms-source-file-default-directory