mirror of
https://github.com/beetbox/beets.git
synced 2025-12-24 09:33:46 +01:00
Support m3u8 ending in playlist plugin (#5829)
m3u8 files are technically supported in the playlist plugin, only the difference in the file ending prevented usage of such files.
This commit is contained in:
commit
a01e603492
2 changed files with 9 additions and 3 deletions
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -26,6 +26,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:
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue