emms-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/1] emms-source-playlist.el: add native playlist to cache


From: Leo Okawa Ericson
Subject: [PATCH 1/1] emms-source-playlist.el: add native playlist to cache
Date: Sat, 7 Jan 2023 16:24:07 +0100

The function for parsing native playlists doesn't use the emms-track
constructor because the data is already in the correct format.  However
this means that it misses the call to `emms-cache-set-function`, meaning
that the playlist doesn't get added to the cache and the emms-browser.
---
 emms-source-playlist.el | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/emms-source-playlist.el b/emms-source-playlist.el
index aca63b7..e23f1b8 100644
--- a/emms-source-playlist.el
+++ b/emms-source-playlist.el
@@ -209,9 +209,16 @@ (defun emms-source-playlist-native-p ()
 (defun emms-source-playlist-parse-native (file)
   "Parse the native EMMS playlist in the current buffer."
   (ignore file)
-  (save-excursion
-    (goto-char (point-min))
-    (read (current-buffer))))
+  (let ((tracks (save-excursion
+                 (goto-char (point-min))
+                 (read (current-buffer)))))
+    (mapc (lambda (track)
+            (funcall emms-cache-set-function
+                     (emms-track-type track)
+                     (emms-track-name track)
+                     track))
+          tracks)
+    tracks))
 
 (defun emms-source-playlist-unparse-native (in out)
   "Unparse a native playlist from IN to OUT.
-- 
2.39.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]