summaryrefslogtreecommitdiffhomepage
path: root/init.org
diff options
context:
space:
mode:
Diffstat (limited to 'init.org')
-rw-r--r--init.org99
1 files changed, 20 insertions, 79 deletions
diff --git a/init.org b/init.org
index 03cd9bc..d2dc404 100644
--- a/init.org
+++ b/init.org
@@ -2949,81 +2949,6 @@
(defalias 'jao-spotify-artist #'consult-spotify-artist)
(defalias 'jao-spotify-playlist #'consult-spotify-playlist)
#+end_src
-*** mpdel
- #+BEGIN_SRC emacs-lisp
- (jao-load-path "libmpdel")
- (jao-load-path "mpdel")
- (jao-load-path "navigel")
-
- (use-package navigel
- :init (setq navigel-display-messages nil))
-
- (defun jao-mpdel-dup-dir-p (dir)
- (and (libmpdel-directory-p dir)
- (string-match-p "\\[.+\\]\\b"
- (or (libmpdel--directory-path dir) ""))))
-
- (defun jao-mpdel--filter (dirs)
- (cl-remove-if 'jao-mpdel-dup-dir-p dirs))
-
- (use-package libmpdel
- :init (setq libmpdel-port 6669))
-
- (use-package mpdel
- :diminish
- :init
- (setq mpdel-browser-list-clean-up-function 'identity
- mpdel-browser-top-level-entries
- '(directories
- empty-line
- stored-playlists current-playlist
- empty-line
- "Spotify/Top Lists/Top artists/Personal"
- "Spotify/Playlists/Featured"
- empty-line
- search-album search-artist search-title))
-
- (defun jao-mpdel--show-osd (data song ml)
- (let* ((no (1+ (string-to-number (or (cdr (assq 'song data)) "0"))))
- (to (or (cdr (assq 'playlistlength data)) "0"))
- (album (or (libmpdel-album-name song) ""))
- (artist (or (libmpdel-artist-name song) ""))
- (tms (split-string (or (cdr (assq 'time data)) "0/0") ":"))
- (tm (format "%s/%s"
- (libmpdel-time-to-string (car tms))
- (libmpdel-time-to-string (cadr tms))))
- (title (format "%s %s/%s. %s" tm no to
- (or (libmpdel-entity-name song) ""))))
- (if ml
- (message "%s %s - %s (%s)" tm title artist album)
- (jao-notify (format "%s (%s)" artist album)
- title
- jao-notify-audio-icon))))
-
- (defun jao-mpdel-show-osd (&optional ml)
- (interactive "P")
- (let ((song (libmpdel-current-song)))
- (when song
- (libmpdel-send-command "status"
- `(lambda (data)
- (jao-mpdel--show-osd data ,song ,ml))))))
-
- (defun jao-mpdel-search (&optional type)
- (interactive
- (list (completing-read "Search by: " '("album" "artist" "title"))))
- (let* ((func (cond ((string= type "album") 'mpdel-core-search-by-album)
- ((string= type "artist") 'mpdel-core-search-by-artist)
- ((string= type "title") 'mpdel-core-search-by-title)))
- (thing (read-from-minibuffer (format "Search for %s: " type))))
- (mpdel-core-open (libmpdel-search-criteria-create :type type :what thing)))))
-
- (use-package mpdel-browser)
- (defalias 'mpdel-pop-to-browser 'mpdel-browser-open)
-
- (mpdel-mode)
- (define-key mpdel-browser-mode-map (kbd "n") #'next-line)
- (define-key mpdel-browser-mode-map (kbd "p") #'previous-line)
- #+END_SRC
*** mpc
#+begin_src emacs-lisp
(use-package elmpd :ensure t)
@@ -3046,6 +2971,23 @@
(defalias 'jao-player-list 'jao-mpc-show-playlist)
(defalias 'jao-player-browse 'jao-mpc-show-albums)
#+end_src
+*** mopidy
+ #+begin_src emacs-lisp
+ (defvar jao-mopidy-port 6669)
+ (defvar jao-mopidy-conn
+ (let ((jao-mpc-port jao-mopidy-port)) (jao-mpc--connect "jao-mopidy")))
+
+ (defmacro jao-mopidy-def (name args &rest body)
+ `(defun ,name ,args
+ (interactive)
+ (let ((jao-mpc--connection jao-mopidy-conn)
+ (jao-mpc-port jao-mopidy-port))
+ ,@body)))
+
+ (jao-mopidy-def jao-mopidy-show-playlist () (jao-mpc-show-playlist))
+ (jao-mopidy-def jao-mopidy-clear () (jao-mpc-clear))
+ (jao-mopidy-def jao-mopidy-disconnect () (jao-mpc-disconnect))
+ #+end_src
*** hydras
#+begin_src emacs-lisp
(require 'jao-lyrics)
@@ -3088,11 +3030,10 @@
(("s" espotify-play-pause "toggle")
("n" espotify-next "next")
("p" espotify-previous "previous")
- ("w" jao-mpdel-show-osd "currently playing"))
+ ("w" jao-mpris-show-osd "currently playing"))
"Browse"
- (("b" mpdel-pop-to-browser "browser")
- ("l" mpdel-playlist-open "playing list")
- ("c" (mpdel-core-replace-current-playlist) "clear list" :color red)
+ (("l" jao-mopidy-show-playlist "playing list")
+ ("c" jao-mopidy-clear "clear list" :color red)
("s-s" jao-hydra-spotify/body nil))))
(pretty-hydra-define jao-hydra-media