summaryrefslogtreecommitdiffhomepage
path: root/init.org
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2022-05-22 00:52:48 +0100
committerjao <jao@gnu.org>2022-05-22 00:52:48 +0100
commita32821d78893d654523b8f6f421408e756b7723b (patch)
tree2eab4a771be582acec4aed78bba4954b33744242 /init.org
parentc9bd41b9a49b3f77fb4a930db1e8fcc1d00c0d4c (diff)
downloadelibs-a32821d78893d654523b8f6f421408e756b7723b.tar.gz
elibs-a32821d78893d654523b8f6f421408e756b7723b.tar.bz2
mopidy-tidal
Diffstat (limited to 'init.org')
-rw-r--r--init.org39
1 files changed, 27 insertions, 12 deletions
diff --git a/init.org b/init.org
index c0dc2bb..282030d 100644
--- a/init.org
+++ b/init.org
@@ -3179,17 +3179,27 @@
:demand t
:commands jao-mpc-setup)
- ;; (defvar jao-mopidy-port 6669)
- (defvar jao-mopidy-port nil)
+ (defvar jao-mopidy-port 6669)
+ (defvar jao-mpc-last-port nil)
+
+ (defun jao-mpc-toggle-port ()
+ (interactive)
+ (setq jao-mpc-last-port (unless jao-mpc-last-port jao-mopidy-port)
+ jao-mpc-port jao-mpc-last-port))
+
(jao-mpc-setup jao-mopidy-port (if jao-modeline-in-minibuffer -10 70))
- (defun jao-mpc-pport ()
- (when (jao-mpc--playing-p jao-mopidy-port) jao-mopidy-port))
+ (defun jao-mpc-pport (&optional mop)
+ (cond ((or mop (jao-mpc--playing-p jao-mopidy-port)) jao-mopidy-port)
+ ((jao-mpc--playing-p) nil)
+ (t jao-mpc-last-port)))
(defmacro jao-defun-play (name &optional mpc-name)
- `(defun ,(intern (format "jao-player-%s" name)) ()
- (interactive)
- (,(intern (format "jao-mpc-%s" (or mpc-name name))) (jao-mpc-pport))))
+ (let ((arg (gensym)))
+ `(defun ,(intern (format "jao-player-%s" name)) (&optional ,arg)
+ (interactive "P")
+ (,(intern (format "jao-mpc-%s" (or mpc-name name)))
+ (setq jao-mpc-last-port (jao-mpc-pport ,arg))))))
(jao-defun-play toggle)
(jao-defun-play next)
@@ -3198,10 +3208,11 @@
(jao-defun-play echo echo-current)
(jao-defun-play list show-playlist)
(jao-defun-play info lyrics-track-data)
+ (jao-defun-play browse show-albums)
+ (jao-defun-play select-album)
(defun jao-player-seek (delta) (jao-mpc-seek delta (jao-mpc-pport)))
- (defalias 'jao-player-browse 'jao-mpc-show-albums)
(defalias 'jao-player-connect 'jao-mpc-connect)
(defalias 'jao-player-play 'jao-mpc-play)
#+end_src
@@ -3278,12 +3289,11 @@
("m" "toggle" jao-player-toggle)
("n" "next" jao-player-next)
("p" "previous" jao-player-previous)
- ("s" "toggle streaming" jao-streaming-toggle)
- ]
+ ("s" "select album" jao-player-select-album)]
["Seek and search"
("f" "seek fwd" jao-player-seek-10 :transient t)
("F" "seek bwd" jao-player-seek--10 :transient t)
- ("a" "select album" jao-mpc-select-album)]
+ ("a" "search album" jao-mpc-search-and-select-album)]
["Browse"
("b" "browse" jao-player-browse)
("l" "show play list" jao-player-list)
@@ -3303,7 +3313,12 @@
("N" "next random album" jao-random-album-next)
("r" (lambda ()
(concat (if jao-random-album-p "dis" "en") "able random album"))
- jao-random-album-toggle)]])
+ jao-random-album-toggle)
+ ("P" (lambda ()
+ (concat "Toggle to "
+ (if (equal jao-mpc-last-port jao-mopidy-port)
+ "mpd" "mopidy")))
+ jao-mpc-toggle-port)]])
(global-set-key (kbd "s-m") #'jao-transient-media)