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