fix: don't parse PUT
's third argument as JSON
This commit is contained in:
parent
c1e72da7fc
commit
d1307762b4
1 changed files with 2 additions and 7 deletions
|
@ -1,6 +1,5 @@
|
||||||
import sys
|
import sys
|
||||||
import shlex
|
import shlex
|
||||||
import json
|
|
||||||
|
|
||||||
class SRTMerger:
|
class SRTMerger:
|
||||||
def __init__(self, srt1_filename, srt2_filename, commands_filename, output_filename):
|
def __init__(self, srt1_filename, srt2_filename, commands_filename, output_filename):
|
||||||
|
@ -155,12 +154,8 @@ class SRTMerger:
|
||||||
index = int(parts[2])
|
index = int(parts[2])
|
||||||
if index < 1:
|
if index < 1:
|
||||||
return None
|
return None
|
||||||
json_str = parts[3]
|
text = parts[3]
|
||||||
data = json.loads(json_str)
|
except (ValueError, TypeError) as e:
|
||||||
if 'text' not in data:
|
|
||||||
return None
|
|
||||||
text = data['text']
|
|
||||||
except (ValueError, json.JSONDecodeError, TypeError) as e:
|
|
||||||
return None
|
return None
|
||||||
return ('PUT', source, index, text)
|
return ('PUT', source, index, text)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue