[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/1] emms-source-playlist.el: add native playlist to cache
From: |
Yoni Rabkin |
Subject: |
Re: [PATCH 1/1] emms-source-playlist.el: add native playlist to cache |
Date: |
Wed, 11 Jan 2023 16:24:07 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) |
Leo Okawa Ericson <git@relevant-information.com> writes:
> 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.
I don't see a problem with the patch in and of itself. But if some
tracks were saved as a native playlist, doesn't that mean that they were
already loaded and therefore already in the cache?
Are you referring a case where you import an Emms native playlist to an
instance that has never seen those tracks before. Do I understand the
use-case correctly?
> ---
> 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.
--
"Cut your own wood and it will warm you twice"