1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-06-17 00:07:37 +02:00

simplify single quote handling

This commit is contained in:
Kelly Brazil
2022-07-16 21:16:29 -07:00
parent d6ed5a0eba
commit c04fd5bbf9
2 changed files with 4 additions and 4 deletions

View File

@ -130,8 +130,7 @@ def parse(
# extended info fields # extended info fields
if line.lstrip().startswith('#EXTINF:'): if line.lstrip().startswith('#EXTINF:'):
newline = line.replace("'", "") # single quotes break shlex split splitline = line.strip().split(':', maxsplit=1)
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
@ -140,6 +139,7 @@ def parse(
extline = shlex.shlex(splitline[1], posix=True) extline = shlex.shlex(splitline[1], posix=True)
extline.whitespace_split = True extline.whitespace_split = True
extline.whitespace = ', ' # add comma to whitespace detection extline.whitespace = ', ' # add comma to whitespace detection
extline.quotes = '"' # remove single quotes
extline_list = list(extline) extline_list = list(extline)
runtime = extline_list.pop(0) runtime = extline_list.pop(0)
display_list = [] display_list = []
@ -152,7 +152,7 @@ def parse(
else: else:
display_list.append(item) display_list.append(item)
display = ' '.join(display_list).replace("", "'") display = ' '.join(display_list)
output_line.update({ output_line.update({
'runtime': runtime, 'runtime': runtime,
'display': display 'display': display

File diff suppressed because one or more lines are too long