From e5b6526056de4db90d4b6a7a682a4260c13021ac Mon Sep 17 00:00:00 2001 From: jao Date: Wed, 9 Feb 2022 05:34:21 +0000 Subject: despotify --- attic/misc.org | 121 ++++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 102 insertions(+), 19 deletions(-) (limited to 'attic') diff --git a/attic/misc.org b/attic/misc.org index 2cb0fce..c10b1c6 100644 --- a/attic/misc.org +++ b/attic/misc.org @@ -955,6 +955,108 @@ (add-hook 'notmuch-show-hook #'jao-notmuch--show-hidden-html)) #+end_src +* link-hint for w3m + #+begin_src emacs-lisp + (defun jao-link-hint--notmuch-next-url (&optional bound) + (link-hint--next-property 'w3m-href-anchor bound)) + + (defun jao-link-hint--notmuch-url-at-point () + (get-text-property (point) 'w3m-href-anchor)) + + (link-hint-define-type 'notmuch-w3m-url + :next #'jao-link-hint--notmuch-next-url + :at-point-p #'jao-link-hint--notmuch-url-at-point + :vars '(notmuch-show-mode) + :open #'browse-url + :open-multiple t + :copy #'kill-new) + + (push 'link-hint-notmuch-w3m-url link-hint-types) + + #+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"))) + + (transient-define-prefix jao-transient-streaming () + [:description + (lambda () (format "Streaming using %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)] + ["Play" + ("s" "toggle" jao-streaming-toggle) + ("n" "next" jao-streaming-next) + ("p" "previous" jao-streaming-prev)] + ["Seek & shout" + ("f" "seek fwd" jao-streaming-seek :transient t) + ("F" "seek bwd" jao-streaming-seek-back :transient t) + ("u" "up" jao-streaming-volume :transient t) + ("d" "down" jao-streaming-volume-down :transient t)] + ["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)] + ["Act" + ("k" "like" jao-streaming-like) + ("K" "dislike" jao-streaming-dislike) + ("S" "toggle shuffling" jao-spt-toggle-shuffle :if jao-spt-on-p)]]) + #+end_src * snippets #+begin_src emacs-lisp (defun jao-minibuffer--text-with-padding (text) @@ -1004,22 +1106,3 @@ ;; pdf-view-next-line-or-next-page)) ;; (advice-add f :after #'jao--refresh)) #+end_src -* link-hint for w3m - #+begin_src emacs-lisp - (defun jao-link-hint--notmuch-next-url (&optional bound) - (link-hint--next-property 'w3m-href-anchor bound)) - - (defun jao-link-hint--notmuch-url-at-point () - (get-text-property (point) 'w3m-href-anchor)) - - (link-hint-define-type 'notmuch-w3m-url - :next #'jao-link-hint--notmuch-next-url - :at-point-p #'jao-link-hint--notmuch-url-at-point - :vars '(notmuch-show-mode) - :open #'browse-url - :open-multiple t - :copy #'kill-new) - - (push 'link-hint-notmuch-w3m-url link-hint-types) - - #+end_src -- cgit v1.2.3