Yoni Rabkin <[email protected]> writes: > Pierre Neidhardt <[email protected]> writes: > >> Yoni Rabkin <[email protected]> writes: >> >>>> That said, I think Emms should be smarter here: I think it should detect >>>> whether the target is a playlist or a track. What about having just one >>>> `emms-add-file` function then? >>> >>> absolutely >> >> I can work on it but I'm not so familiar with that part of the code. >> Any cue there, Yoni? > > A primitive/naive solution should be relatively straightforward. For > example modifying `define-emms-source file': > > (define-emms-source file (file) > "An EMMS source for a single file - either FILE, or queried from the > user." > (interactive (list (read-file-name "Play file: " > emms-source-file-default-directory > emms-source-file-default-directory > t))) > (cond ((file-directory-p file) > (emms-source-directory file)) > ((emms-file-playlist-p file) > (emms-add-playlist file)) > (t (emms-playlist-insert-track > (emms-track 'file (expand-file-name file)))))) > > > ... where `emms-file-playlist-p' doesn't exist yet, but would try to > naively detect if it is a playlist (checks extension). It would probably > need to have unwind protection in case that the playlist file isn't > supported by `emms-add-playlist' (checks content). > > After all, `define-emms-source file' already checks to see if you've > pointed it at a directory so there is no reason not to keep on > overloading that function until it starts doing what we mean. > > Does that make sense?
Totally. Will implement as soon as possible. > P.S. If you are OK with it, we should probably be copying the mailing > list on this as well. Done, I had missed that I only replied to you after you've sent me an e-mail offlist. To avoid this in the future, I think it's good practice to always keep all recipients within an e-mail threads and to send offlist e-mails separately. -- Pierre Neidhardt
signature.asc
Description: PGP signature
_______________________________________________ Emms-help mailing list [email protected] https://lists.gnu.org/mailman/listinfo/emms-help
