Skip to content

Commit a64acf8

Browse files
authored
Merge branch 'master' into feature/add-artist-to-item-entry-template
2 parents b96f7a5 + a01e603 commit a64acf8

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

beetsplug/playlist.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,20 @@
1212
# included in all copies or substantial portions of the Software.
1313

1414

15-
import fnmatch
1615
import os
1716
import tempfile
1817
from collections.abc import Sequence
18+
from pathlib import Path
1919

2020
import beets
2121
from beets.dbcore.query import BLOB_TYPE, InQuery
2222
from beets.util import path_as_posix
2323

2424

25+
def is_m3u_file(path: str) -> bool:
26+
return Path(path).suffix.lower() in {".m3u", ".m3u8"}
27+
28+
2529
class PlaylistQuery(InQuery[bytes]):
2630
"""Matches files listed by a playlist file."""
2731

@@ -45,7 +49,7 @@ def __init__(self, _, pattern: str, __):
4549

4650
paths = []
4751
for playlist_path in playlist_paths:
48-
if not fnmatch.fnmatch(playlist_path, "*.[mM]3[uU]"):
52+
if not is_m3u_file(playlist_path):
4953
# This is not am M3U playlist, skip this candidate
5054
continue
5155

@@ -148,7 +152,7 @@ def find_playlists(self):
148152
return
149153

150154
for filename in dir_contents:
151-
if fnmatch.fnmatch(filename, "*.[mM]3[uU]"):
155+
if is_m3u_file(filename):
152156
yield os.path.join(self.playlist_dir, filename)
153157

154158
def update_playlist(self, filename, base_dir):

docs/changelog.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ New features:
2828
* :doc:`plugins/duplicates`: Add ``--remove`` option, allowing to remove from
2929
the library without deleting media files.
3030
:bug:`5832`
31+
* :doc:`plugins/playlist`: Support files with the `.m3u8` extension.
32+
:bug:`5829`
3133

3234
Bug fixes:
3335

0 commit comments

Comments
 (0)