diff options
author | jao <jao@gnu.org> | 2023-11-26 02:32:26 +0000 |
---|---|---|
committer | jao <jao@gnu.org> | 2023-11-26 02:32:26 +0000 |
commit | 75b07bebbcfb6f472c68b0967c2fb5a201d6f13f (patch) | |
tree | faf79fc4419d2ee69e71982cd9398a6c403bec7f | |
parent | 957d77f523402d1af239c64b853d2d1b6a2bc65e (diff) | |
download | elibs-75b07bebbcfb6f472c68b0967c2fb5a201d6f13f.tar.gz elibs-75b07bebbcfb6f472c68b0967c2fb5a201d6f13f.tar.bz2 |
mpc: old tidal code removed
-rw-r--r-- | attic/elisp/misc.el | 20 | ||||
-rw-r--r-- | init.el | 2 | ||||
-rw-r--r-- | lib/media/jao-mpc.el | 20 |
3 files changed, 21 insertions, 21 deletions
diff --git a/attic/elisp/misc.el b/attic/elisp/misc.el index 534c38a..dc3a76c 100644 --- a/attic/elisp/misc.el +++ b/attic/elisp/misc.el @@ -776,6 +776,26 @@ (enwc-display-mode-line nil))) +;;; tidal/mpc +(defconst jao-mpc--search-cmd + "-f '%%album%% - %%artist%% :::%%file%%' search %s '%s'|grep :::tidal:album") + +(defun jao-mpc--search-albums (query) + (let* ((cmd (format jao-mpc--search-cmd "any" query)) + (str (jao-mpc--cmd cmd)) + (res (split-string str "\n" t))) + (message "%s" str) + (mapcar (lambda (s) (split-string s ":::" t " ")) res))) + +(defun jao-mpc-select-tidal-album (&optional query port) + (interactive "sSearch terms: ") + (let* ((jao-mpc-port (or port jao-mpc-port)) + (resa (jao-mpc--search-albums query))) + (if (null resa) + (user-error "No results") + (when-let* ((a (completing-read "Play album: " resa nil t)) + (s (car (alist-get a resa nil nil 'string=)))) + (jao-mpc--add-and-play s port t))))) ;;; snippets (defun jao-sway-run-or-focus-tidal () (interactive) @@ -2959,7 +2959,7 @@ ["Seek and search" ("f" "seek fwd" jao-player-seek-10 :transient t) ("F" "seek bwd" jao-player-seek--10 :transient t) - ("a" "search album" jao-mpc-search-and-select-album) + ("a" "search album" jao-mpc-select-album) ("S" "play stream" jao-mpc-play-stream)] ["Browse" ("b" "browse" jao-player-browse) diff --git a/lib/media/jao-mpc.el b/lib/media/jao-mpc.el index 74f9b5b..4aef47d 100644 --- a/lib/media/jao-mpc.el +++ b/lib/media/jao-mpc.el @@ -323,25 +323,5 @@ (when-let (album (completing-read "Play album: " albums nil t)) (jao-mpc--add-and-play (car (split-string album "-" t " ")) port)))) -(defconst jao-mpc--search-cmd - "-f '%%album%% - %%artist%% :::%%file%%' search %s '%s'|grep :::tidal:album") - -(defun jao-mpc--search-albums (query) - (let* ((cmd (format jao-mpc--search-cmd "any" query)) - (str (jao-mpc--cmd cmd)) - (res (split-string str "\n" t))) - (mapcar (lambda (s) (split-string s ":::" t " ")) res))) - -;;;###autoload -(defun jao-mpc-search-and-select-album (&optional query port) - (interactive "sSearch terms: ") - (let* ((jao-mpc-port (or port jao-mpc-port)) - (resa (jao-mpc--search-albums query))) - (if (null resa) - (user-error "No results") - (when-let* ((a (completing-read "Play album: " resa nil t)) - (s (car (alist-get a resa nil nil 'string=)))) - (jao-mpc--add-and-play s port t))))) - (provide 'jao-mpc) ;;; jao-mpc.el ends here |