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

Yoni Rabkin <[email protected]>
Newsgroups gmane.emacs.emms.user
Message-ID <[email protected]>
Leo Okawa Ericson <[email protected]> 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"
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.