From e5b6526056de4db90d4b6a7a682a4260c13021ac Mon Sep 17 00:00:00 2001 From: jao Date: Wed, 9 Feb 2022 05:34:21 +0000 Subject: despotify --- init.org | 114 ++++++++++++++------------------------------------------------- 1 file changed, 25 insertions(+), 89 deletions(-) (limited to 'init.org') diff --git a/init.org b/init.org index 531fa8d..9333074 100644 --- a/init.org +++ b/init.org @@ -2691,6 +2691,7 @@ (defun jao-ssh () (interactive) (let ((h (completing-read "Host: " (jao-tramp-hosts)))) + (jao-afio-goto-scratch) (jao-exec-in-term (format "ssh %s" h) (format "*ssh %s*" h)))) #+end_src * Chats @@ -2944,86 +2945,24 @@ (interactive "P") (jao-show-lyrics force #'jao-mpris-artist-title)) - (use-package jao-mpris - :demand t - :config - (defun jao-mpris-setup-aliases () - (setq espotify-play-uri-function #'espotify-play-uri-with-dbus) - (if (functionp 'jao-exwm-deezer) - (defalias 'jao-streaming-list #'jao-exwm-deezer) - (defalias 'jao-streaming-list #'ignore)) - (defalias 'jao-streaming-lyrics #'jao-mpris-lyrics) - (defalias 'jao-streaming-toggle #'jao-mpris-play-pause) - (defalias 'jao-streaming-next #'jao-mpris-next) - (defalias 'jao-streaming-prev #'jao-mpris-previous) - (defalias 'jao-streaming-current #'jao-mpris-show-osd) - (defalias 'jao-streaming-seek #'jao-mpris-seek) - (defalias 'jao-streaming-seek-back #'jao-mpris-seek-back) - (defalias 'jao-streaming-volume #'jao-mpris-vol) - (defalias 'jao-streaming-volume-down #'jao-mpris-vol-down))) + (use-package jao-mpris :demand t) + (defalias 'jao-streaming-list + (if jao-sway-enabled #'jao-sway-run-or-focus-deezer #'ignore)) (defalias 'jao-streaming-like #'ignore) (defalias 'jao-streaming-dislike #'ignore) + (defalias 'jao-streaming-lyrics #'jao-mpris-lyrics) + (defalias 'jao-streaming-toggle #'jao-mpris-play-pause) + (defalias 'jao-streaming-next #'jao-mpris-next) + (defalias 'jao-streaming-prev #'jao-mpris-previous) + (defalias 'jao-streaming-current #'jao-mpris-show-osd) + (defalias 'jao-streaming-seek #'jao-mpris-seek) + (defalias 'jao-streaming-seek-back #'jao-mpris-seek-back) + (defalias 'jao-streaming-volume #'jao-mpris-vol) + (defalias 'jao-streaming-volume-down #'jao-mpris-vol-down) - (jao-mpris-setup-aliases) - (jao-mpris-register "mopidy" :system (if jao-modeline-in-minibuffer-p -10 70)) - (jao-mpris-register "firefox" :session) - (jao-mpris-register "chromium" :session) - - #+end_src -*** spotify - Access to spotify uses packages tangled from [[./lib/media/espotify.org][espotify.org]], which - offers functionality tailored to the completion engines at hand: - #+begin_src emacs-lisp - (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)) - - (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))) - - (defvar jao-spt-on nil) - (defun jao-spt-on-p () jao-spt-on) - ;; (jao-spt-setup-aliases) - - (jao-def-exec-in-term "spt" "spt" (jao-afio--goto-scratch-1)) - - (defun jao-streaming-toggle-player () - (interactive) - (if jao-spt-on - (let ((player (completing-read "Player: " - '( "chromium" "mopidy" "firefox" - "spotify") - nil nil nil nil jao-mpris-player))) - (setq jao-mpris-player player) - (jao-mpris-setup-aliases)) - (jao-spt-setup-aliases)) - (message "%s activated " - (if (setq jao-spt-on (not jao-spt-on)) "spt" "mpris"))) + (jao-mpris-register "playerctld" + :session (if jao-modeline-in-minibuffer-p -10 70)) #+end_src *** mpc @@ -3103,14 +3042,12 @@ (transient-define-prefix jao-transient-streaming () [:description - (lambda () (format "Streaming using %s (%s)" - (if jao-spt-on "spt" "MPRIS") - (if jao-spt-on "" jao-mpris-player))) - ["Search" - ("a" "album" jao-streaming-album) - ("A" "artist" jao-streaming-artist) - ("t" "track" jao-streaming-track) - ("P" "playlist" jao-streaming-playlist)] + (lambda () (format "Streaming using %s" jao-mpris-player)) + ;; ["Search" + ;; ("a" "album" jao-streaming-album) + ;; ("A" "artist" jao-streaming-artist) + ;; ("t" "track" jao-streaming-track) + ;; ("P" "playlist" jao-streaming-playlist)] ["Play" ("s" "toggle" jao-streaming-toggle) ("n" "next" jao-streaming-next) @@ -3123,19 +3060,18 @@ ["Browse" ("l" "playing list" jao-streaming-list) ("L" "lyrics" jao-streaming-lyrics) - ("w" "currently playing" jao-streaming-current) - ("T" "toggle player" jao-streaming-toggle-player)] + ("w" "currently playing" jao-streaming-current)] ["Act" ("k" "like" jao-streaming-like) - ("K" "dislike" jao-streaming-dislike) - ("S" "toggle shuffling" jao-spt-toggle-shuffle :if jao-spt-on-p)]]) + ("K" "dislike" jao-streaming-dislike)]]) (transient-define-prefix jao-transient-media () [["Play" ("m" "toggle" jao-player-toggle) ("n" "next" jao-player-next) ("p" "previous" jao-player-previous) - ("s" "toggle spotify" espotify-play-pause)] + ("s" "toggle streaming" jao-streaming-toggle) + ] ["Seek and search" ("f" "seek fwd" jao-player-seek-10 :transient t) ("F" "seek bwd" jao-player-seek--10 :transient t) -- cgit v1.2.3