mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-07-15 01:24:29 +02:00
fix issue with single quotes in extended info
This commit is contained in:
@ -133,7 +133,8 @@ def parse(
|
|||||||
|
|
||||||
# extended info fields
|
# extended info fields
|
||||||
if line.lstrip().startswith('#EXTINF:'):
|
if line.lstrip().startswith('#EXTINF:'):
|
||||||
splitline = line.strip().split(':', maxsplit=1)
|
newline = line.replace("'", "�") # single quotes break shlex split
|
||||||
|
splitline = newline.strip().split(':', maxsplit=1)
|
||||||
|
|
||||||
# best-effort to parse additional extended fields
|
# best-effort to parse additional extended fields
|
||||||
# if a parsing error occurs, a warning message will be
|
# if a parsing error occurs, a warning message will be
|
||||||
@ -141,7 +142,7 @@ def parse(
|
|||||||
try:
|
try:
|
||||||
extline = shlex.shlex(splitline[1], posix=True)
|
extline = shlex.shlex(splitline[1], posix=True)
|
||||||
extline.whitespace_split = True
|
extline.whitespace_split = True
|
||||||
extline.whitespace = ', \n'
|
extline.whitespace = ', ' # add comma to whitespace detection
|
||||||
extline_list = list(extline)
|
extline_list = list(extline)
|
||||||
runtime = extline_list.pop(0)
|
runtime = extline_list.pop(0)
|
||||||
display_list = []
|
display_list = []
|
||||||
@ -154,7 +155,7 @@ def parse(
|
|||||||
else:
|
else:
|
||||||
display_list.append(item)
|
display_list.append(item)
|
||||||
|
|
||||||
display = ' '.join(display_list)
|
display = ' '.join(display_list).replace("�", "'")
|
||||||
output_line.update({
|
output_line.update({
|
||||||
'runtime': runtime,
|
'runtime': runtime,
|
||||||
'display': display
|
'display': display
|
||||||
|
Reference in New Issue
Block a user