diff options
-rw-r--r-- | lib/media/jao-mpc.el | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/lib/media/jao-mpc.el b/lib/media/jao-mpc.el index 4aef47d..70531e1 100644 --- a/lib/media/jao-mpc.el +++ b/lib/media/jao-mpc.el @@ -1,6 +1,6 @@ ;;; jao-mpc.el --- Using mpc to interact with mpd -*- lexical-binding: t; -*- -;; Copyright (C) 2021, 2022 jao +;; Copyright (C) 2021, 2022, 2024 jao ;; Author: jao <mail@jao.io> ;; Keywords: convenience @@ -117,7 +117,7 @@ (setq jao-mpc-minibuffer-str (if (string= "playing" status) (jao-mpc--current-str port) "")) (when (and jao-random-album-active - (string= status "paused") + (or (string= status "stopped") (string= status "paused")) (string= "0\n" (jao-mpc--cmd "status %songpos%" port))) (jao-random-album-next))) (jao-minibuffer-refresh)) @@ -199,15 +199,22 @@ (let ((jao-mpc-port (or port jao-mpc-port))) (jao-mpc-playlist-mode)) (current-buffer))) +(defun jao-mpc--with-delayed-random-album (cmd port) + (let ((st jao-random-album-active)) + (setq jao-random-album-active nil) + (jao-mpc--cmd cmd port) + (accept-process-output nil 0.5) + (setq jao-random-album-active st))) + ;;;###autoload (defun jao-mpc-stop (&optional port) (interactive) - (jao-mpc--cmd "stop" port)) + (jao-mpc--with-delayed-random-album "stop" port)) ;;;###autoload (defun jao-mpc-toggle (&optional port) (interactive) - (jao-mpc--cmd "toggle" port)) + (jao-mpc--with-delayed-random-album "toggle" port)) ;;;###autoload (defun jao-mpc-play (&optional port) @@ -240,6 +247,11 @@ (message "%s" (jao-mpc--current-str port t))) ;;;###autoload +(defun jao-mpc-echo-current-times (&optional port) + (interactive) + (message "Playing time: %s" (jao-mpc--current-timestr t))) + +;;;###autoload (defun jao-mpc-add-url (url) (interactive "sURL: ") (jao-mpc--cmd (format "add %s" url))) |