Skip to content
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

fix: expect EXTM3U item fields to be URL-encoded #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions beetsplug/webm3u/playlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import sys
import unicodedata
from flask import current_app as app
from urllib.parse import unquote
from werkzeug.utils import safe_join

extinf_regex = re.compile(r'^#EXTINF:([0-9]+)( [^,]+)?,[\s]*(.*)')
Expand Down Expand Up @@ -99,7 +100,6 @@ def __init__(self, name):
def parse_m3u_playlist(filepath):
'''
Parses an M3U playlist and yields its items, one at a time.
CAUTION: Attribute values that contain ',' or ' ' are not supported!
'''
with open(filepath, 'r', encoding='UTF-8') as file:
linenum = 0
Expand All @@ -119,7 +119,7 @@ def parse_m3u_playlist(filepath):
item.duration = int(duration)
attrs = m.group(2)
if attrs:
item.attrs = {k: v.strip('"') for k,v in [kv.split('=') for kv in attrs.strip().split(' ')]}
item.attrs = {k: unquote(v.strip('"')) for k,v in [kv.split('=') for kv in attrs.strip().split(' ')]}
else:
item.attrs = {}
item.title = m.group(3)
Expand Down
Loading