Skip to content

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

Merged
merged 3 commits into from
Jul 7, 2025
Merged

Conversation

JOJ0
Copy link
Member

@JOJ0 JOJ0 commented Jun 21, 2025

Description

m3u8 files are technically supported in the playlist plugin, only the difference in the file ending prevented usage of such files.

  • Documentation. (not required, the current wording implies support of m3u files in general, this should include m3u8 which only makes clear that they are UTF-8 encoded)
  • Changelog. (will do after review)
  • Tests. (not required)

Copy link

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.

@JOJ0 JOJ0 marked this pull request as ready for review June 21, 2025 09:26
@Copilot Copilot AI review requested due to automatic review settings June 21, 2025 09:26
Copy link

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.

Copy link
Contributor

@Copilot Copilot AI left a 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.

@JOJ0 JOJ0 force-pushed the playlist_m3u8 branch from 2caac81 to 8d58a82 Compare July 3, 2025 08:49
JOJ0 added a commit to JOJ0/beets that referenced this pull request Jul 3, 2025
JOJ0 added a commit to JOJ0/beets that referenced this pull request Jul 3, 2025
@JOJ0 JOJ0 force-pushed the playlist_m3u8 branch from 469a6ff to ace8d96 Compare July 3, 2025 08:56
@JOJ0
Copy link
Member Author

JOJ0 commented Jul 3, 2025

I think this is ready to go @wisp3rwind

Copy link
Member

@wisp3rwind wisp3rwind left a 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.)

@JOJ0
Copy link
Member Author

JOJ0 commented Jul 4, 2025

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?).

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.

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.)

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 ?

@JOJ0 JOJ0 force-pushed the playlist_m3u8 branch from 0686295 to b66682e Compare July 6, 2025 07:00
Copy link
Member

@snejus snejus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lovely, thanks <3

@snejus
Copy link
Member

snejus commented Jul 6, 2025

@JOJ0 Seems like there's a conflict in the changelog

@JOJ0 JOJ0 force-pushed the playlist_m3u8 branch from b66682e to cf557fb Compare July 7, 2025 06:06
@JOJ0 JOJ0 enabled auto-merge July 7, 2025 06:07
@JOJ0 JOJ0 merged commit a01e603 into beetbox:master Jul 7, 2025
14 checks passed
5061726b6572 pushed a commit to 5061726b6572/beets that referenced this pull request Jul 9, 2025
matlads pushed a commit to matlads/beets that referenced this pull request Jul 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants