summaryrefslogtreecommitdiffhomepage
path: root/init.el
diff options
context:
space:
mode:
Diffstat (limited to 'init.el')
-rw-r--r--init.el69
1 files changed, 62 insertions, 7 deletions
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)