-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Support m3u8 ending in playlist plugin #5829
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Thank you for the PR! The changelog has not been updated, so here is a friendly reminder to check if you need to add an entry. |
Thank you for the PR! The changelog has not been updated, so here is a friendly reminder to check if you need to add an entry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request updates the playlist plugin to support m3u8 files by replacing the hardcoded glob pattern with a new constant (M3U_GLOB) used in both playlist scanning and directory listing.
- Introduces the M3U_GLOB constant to capture m3u8 file endings.
- Refactors the file matching checks to use the new constant.
I think this is ready to go @wisp3rwind |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code changes themselves look fine 🎉
I am wondering about the encoding of the playlist files, however: At a quick glance, the plugin will open files in binary mode and read/write paths to the file in filesystem encoding. These days, that is very likely, but not guaranteed to be utf8 (it's definitely on Windows due to PEP529).
Shouldn't the plugin rather explicitly encode to utf8 for .m3u8
? (And raise an error if that can't be done.)
That said, I'm not familiar at all with this plugin, m3u, or the details of filesystem encodings. Not sure what consumers of the m3u(8) file would expect (in particular, what if playlist and filesystem encoding are different?).
Eventually, we might also consider not supporting non-Unicode paths in beets in general, but as far as I know, we presently claim to support such paths. (I'm not sure how well-tested that really is.)
At the end of the day m3u8 is just a file ending that someone invented for something but it is not well known or documented what it is exactly. I find that some software's just use m3u and m3u8 interchangeably. The most official "documentation" I always seem to find is this one: https://en.wikipedia.org/wiki/M3U#M3U8 This sentence is interesting: The 2015 proposal for the HLS playlist format uses UTF-8 exclusively and does not distinguish between the "m3u" and "m3u8" file name extensions. I have support for m3u8 extension in my personal main beets branch for ages since Pioneer rekordbox exports their playlist files as m3u8, even though they could simply use m3u since they do not do anything in regarrd to streaming. It is just playlist files with paths to local media files. Renaming those files to m3u constantly was a productivity-killer. So again, at the end of the day, m3u and m3u8 are interchangeable simple file extensions, nothing else and no magic.
This is an interesting idea. Let's move further improvements of this plugin and how it handles files to another issue/PR. I suggest we merge this one and open a new issue with things to be done/improve in beets in general and in this plugin. I personally would like to refactor this plugin anyway if I find time. What do yout think @wisp3rwind ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lovely, thanks <3
@JOJ0 Seems like there's a conflict in the changelog |
Description
m3u8 files are technically supported in the playlist plugin, only the difference in the file ending prevented usage of such files.