Commit f4c704f63d22

Vincent Demeester <vincent@sbr.pm>
2026-11-26 12:38:09
fix: restored playlist actions in Embark
Fixed collection previews and playlist playback so Navidrome playlists could be managed from Emacs. Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent 790ad24
Changed files (1)
dots
config
emacs
dots/config/emacs/init.el
@@ -1676,9 +1676,7 @@ minibuffer, even without explicitly focusing it."
 
 (use-package embark-consult
   :after (embark consult)
-  :unless noninteractive
-  :hook
-  (embark-collect-mode . consult-preview-at-point-mode))
+  :unless noninteractive)
 
 (use-package consult-gh
   :after (consult)
@@ -3598,6 +3596,27 @@ With \\[universal-argument] \\[universal-argument]: always prompt with completio
                              (message "Playlist '%s' is empty" name))))))
                   (funcall orig selected on-quit))))
 
+  (defun my/empv-subsonic-act-on-playlist (orig action obj)
+    "Apply ACTION to playlist OBJ, or delegate to ORIG."
+    (if (eq (alist-get 'kind obj) 'playlist)
+        (empv--subsonic-request
+         "getPlaylist.view" :id (alist-get 'id obj)
+         (lambda (response)
+           (let ((songs (or (alist-get 'results response)
+                            (alist-get 'entry response))))
+             (if songs
+                 (funcall (or action #'empv-play)
+                          (mapcar (lambda (song)
+                                    (empv--subsonic-item-extract-url
+                                     (thread-first song
+                                       (map-insert 'kind 'song)
+                                       (map-insert 'type 'subsonic))))
+                                  songs))
+               (message "Playlist '%s' is empty" (alist-get 'name obj))))))
+      (funcall orig action obj)))
+
+  (advice-add 'empv--subsonic-act :around #'my/empv-subsonic-act-on-playlist)
+
   (defun empv-subsonic-playlists ()
     "List Subsonic playlists and act on selection."
     (interactive)