summaryrefslogtreecommitdiffhomepage
path: root/attic/elisp
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2025-09-27 02:15:36 +0100
committerjao <jao@gnu.org>2025-09-27 02:15:36 +0100
commitd5ba2e907bfafc5ce110fbce99a8e851649d0c9e (patch)
treeeaf9c9d7f08ed94d16de80a3fb0962cf3fa944c4 /attic/elisp
parentf51ee7f74ac2692a31bfef94e91fcb8cd7bd477f (diff)
downloadelibs-d5ba2e907bfafc5ce110fbce99a8e851649d0c9e.tar.gz
elibs-d5ba2e907bfafc5ce110fbce99a8e851649d0c9e.tar.bz2
mpc works on darwin, who knewmain
Diffstat (limited to 'attic/elisp')
-rw-r--r--attic/elisp/misc.el98
1 files changed, 98 insertions, 0 deletions
diff --git a/attic/elisp/misc.el b/attic/elisp/misc.el
index 2213646..69343fb 100644
--- a/attic/elisp/misc.el
+++ b/attic/elisp/misc.el
@@ -1081,3 +1081,101 @@ It should be the title of the web page as returned by `rdrview'"
(if rdrview
(eww-rdrview-toggle-and-reload)
(eww-readable)))
+
+;;; spotify
+(jao-load-path "espotify")
+
+(use-package espotify
+ :demand t
+ :init (setq espotify-service-name "mopidy"))
+
+(use-package consult-spotify :demand t)
+
+(defalias 'jao-streaming-album #'consult-spotify-album)
+(defalias 'jao-streaming-track #'consult-spotify-track)
+(defalias 'jao-streaming-artist #'consult-spotify-artist)
+(defalias 'jao-streaming-playlist #'consult-spotify-playlist)
+
+(jao-def-exec-in-term "ncmpcpp" "ncmpcpp" (jao-afio-goto-scratch))
+
+;;; spt
+(use-package jao-spt
+ :demand t
+ :config
+ (defun jao-spt-setup-aliases ()
+ (setq espotify-play-uri-function #'jao-spt-play-uri)
+ (defalias 'jao-streaming-list #'jao-term-spt)
+ (defalias 'jao-streaming-lyrics #'jao-spt-show-lyrics)
+ (defalias 'jao-streaming-toggle #'jao-spt-toggle)
+ (defalias 'jao-streaming-next #'jao-spt-next)
+ (defalias 'jao-streaming-prev #'jao-spt-previous)
+ (defalias 'jao-streaming-current #'jao-spt-echo-current)
+ (defalias 'jao-streaming-seek #'jao-spt-seek)
+ (defalias 'jao-streaming-seek-back #'jao-spt-seek-back)
+ (defalias 'jao-streaming-volume #'jao-spt-vol)
+ (defalias 'jao-streaming-volume-down #'jao-spt-vol-down)
+ (defalias 'jao-streaming-like #'jao-spt-like)
+ (defalias 'jao-streaming-dislike #'jao-spt-dislike)
+ (defalias 'jao-streaming-toggle-shuffle #'jao-spt-toggle-shuffle)))
+
+(jao-def-exec-in-term "spt" "spt" (jao-afio-goto-scratch))
+
+(defvar jao-spt-on t)
+
+(defun jao-streaming-toggle-player ()
+ (interactive)
+ (if jao-spt-on
+ (progn (setq jao-mpris-player "playerctld")
+ (require 'jao-mpris)
+ (jao-mpris-setup-aliases))
+ (jao-spt-setup-aliases)
+ (setq jao-mpris-player "spt"))
+ (setq jao-spt-on (not jao-spt-on))
+ (message "%s activated " jao-mpris-player))
+
+(jao-streaming-toggle-player)
+
+;;; mpd + mopidy
+(use-package jao-mpc
+ :demand t
+ :commands jao-mpc-setup)
+
+(defvar jao-mopidy-port 6669)
+(defvar jao-mpc-last-port jao-mpc-port)
+
+(defun jao-mpc-toggle-port ()
+ (interactive)
+ (setq jao-mpc-port
+ (if (equal jao-mpc-port jao-mopidy-port) 6600 jao-mopidy-port)
+ jao-mpc-last-port jao-mpc-port))
+
+(defsubst jao-mpc-mopidy-p () (equal jao-mpc-last-port jao-mopidy-port))
+
+(jao-mpc-setup jao-mopidy-port 70)
+
+(defun jao-mpc-pport (&optional mop)
+ (cond ((or mop (jao-mpc-playing-p jao-mopidy-port)) jao-mopidy-port)
+ ((jao-mpc-playing-p) 6600)
+ (t jao-mpc-last-port)))
+
+(defmacro jao-defun-play (name &optional mpc-name)
+ (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)
+(jao-defun-play previous)
+(jao-defun-play stop)
+(jao-defun-play echo echo-current-times)
+(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-connect 'jao-mpc-connect)
+(defalias 'jao-player-play 'jao-mpc-play)