Merge branch 'master' into feature/add-artist-to-item-entry-template

This commit is contained in:
Martin Atukunda 2025-07-07 09:35:15 +03:00 committed by GitHub
commit a64acf8aa2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 3 deletions

View file

@ -12,16 +12,20 @@
# included in all copies or substantial portions of the Software.
import fnmatch
import os
import tempfile
from collections.abc import Sequence
from pathlib import Path
import beets
from beets.dbcore.query import BLOB_TYPE, InQuery
from beets.util import path_as_posix
def is_m3u_file(path: str) -> bool:
return Path(path).suffix.lower() in {".m3u", ".m3u8"}
class PlaylistQuery(InQuery[bytes]):
"""Matches files listed by a playlist file."""
@ -45,7 +49,7 @@ class PlaylistQuery(InQuery[bytes]):
paths = []
for playlist_path in playlist_paths:
if not fnmatch.fnmatch(playlist_path, "*.[mM]3[uU]"):
if not is_m3u_file(playlist_path):
# This is not am M3U playlist, skip this candidate
continue
@ -148,7 +152,7 @@ class PlaylistPlugin(beets.plugins.BeetsPlugin):
return
for filename in dir_contents:
if fnmatch.fnmatch(filename, "*.[mM]3[uU]"):
if is_m3u_file(filename):
yield os.path.join(self.playlist_dir, filename)
def update_playlist(self, filename, base_dir):

View file

@ -28,6 +28,8 @@ New features:
* :doc:`plugins/duplicates`: Add ``--remove`` option, allowing to remove from
the library without deleting media files.
:bug:`5832`
* :doc:`plugins/playlist`: Support files with the `.m3u8` extension.
:bug:`5829`
Bug fixes: