From 0cff3365a6b20b6d736a8f428a7a2899b1c6b9df Mon Sep 17 00:00:00 2001 From: jao Date: Mon, 29 Aug 2022 00:47:25 +0100 Subject: nits --- attic/orgs/misc.org | 8 ------ init.el | 69 ++++++++++++++++++++++++++++++++++++++++++++++------ lib/media/jao-spt.el | 2 +- 3 files changed, 63 insertions(+), 16 deletions(-) diff --git a/attic/orgs/misc.org b/attic/orgs/misc.org index 3a31d6a..6d8d82d 100644 --- a/attic/orgs/misc.org +++ b/attic/orgs/misc.org @@ -222,14 +222,6 @@ :after (consult dtache) :bind ([remap dtache-open-session] . dtache-consult-session)) #+end_src -* signel - #+begin_src emacs-lisp :tangle no - (jao-load-org "lib/net/signel.org") - (with-eval-after-load "tracking" - (jao-tracking-faces 'signel-notification) - (jao-shorten-modes 'signel-chat-mode)) - (setq signel-report-deliveries t) - #+end_src * cdlatex #+begin_src emacs-lisp (use-package cdlatex diff --git a/init.el b/init.el index 5c1250b..63d617d 100644 --- a/init.el +++ b/init.el @@ -54,8 +54,8 @@ (load lf) (message "Attempted to load non existing %s" lf)))) -(defun jao-exec-path (file) - (let ((fn (expand-file-name file))) +(defun jao-exec-path (dir) + (let ((fn (expand-file-name dir))) (add-to-list 'exec-path fn nil) (setenv "PATH" (concat fn ":" (getenv "PATH"))))) @@ -3112,6 +3112,61 @@ (defalias 'jao-player-connect 'jao-mpc-connect) (defalias 'jao-player-play 'jao-mpc-play) +;;;; 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 + ;; (jao-spt-set-up) + (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 t) +(defun jao-spt-on-p () jao-spt-on) + +(jao-def-exec-in-term "spt" "spt" (jao-afio-goto-scratch t)) + +(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) + (setq jao-mpris-player "spt")) + (message "%s activated " + (if (setq jao-spt-on (not jao-spt-on)) "spt" "mpris"))) + ;;;; music transients (require 'jao-lyrics) (setq jao-lyrics-info-function #'jao-player-info) @@ -3156,11 +3211,11 @@ (transient-define-prefix jao-transient-streaming () [:description (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)] + ["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) diff --git a/lib/media/jao-spt.el b/lib/media/jao-spt.el index 4484ead..649a393 100644 --- a/lib/media/jao-spt.el +++ b/lib/media/jao-spt.el @@ -27,7 +27,7 @@ (require 'jao-minibuffer) (require 'jao-notify) -(defvar jao-spt-bin (expand-file-name "~/bin/spt")) +(defvar jao-spt-bin "spt") (defvar jao-spt-format "'%s %t - %a [%r] %f'") (defvar jao-spt-device nil) -- cgit v1.2.3