From 7ddfda9b0af623d5039f7073f6c043f370c129cc Mon Sep 17 00:00:00 2001 From: jao Date: Mon, 31 May 2021 05:21:13 +0100 Subject: jao-mpc: more fat trimming: mpdel to the attic --- attic/misc.org | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) (limited to 'attic') diff --git a/attic/misc.org b/attic/misc.org index 23336e0..7087111 100644 --- a/attic/misc.org +++ b/attic/misc.org @@ -1,5 +1,80 @@ #+title: Miscellaneous config bits that i don't use anymore +* 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 * emms *** configuration #+BEGIN_SRC emacs-lisp -- cgit v1.2.3