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

Leo Okawa Ericson <[email protected]>
Newsgroups gmane.emacs.emms.user
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.