Ensure all json loads calls use strings
This commit is contained in:
parent
cf3b9782ac
commit
e0e4d4c87f
7 changed files with 36 additions and 4 deletions
|
@ -27,6 +27,10 @@ class CuePointAnalyzer(Analyzer):
|
|||
command = [CuePointAnalyzer.SILAN_EXECUTABLE, '-b', '-F', '0.99', '-f', 'JSON', '-t', '1.0', filename]
|
||||
try:
|
||||
results_json = subprocess.check_output(command, stderr=subprocess.STDOUT, close_fds=True)
|
||||
try:
|
||||
results_json = results_json.decode()
|
||||
except (UnicodeDecodeError, AttributeError):
|
||||
pass
|
||||
silan_results = json.loads(results_json)
|
||||
|
||||
# Defensive coding against Silan wildly miscalculating the cue in and out times:
|
||||
|
|
|
@ -157,6 +157,10 @@ class MessageListener:
|
|||
We avoid cascading failure this way.
|
||||
'''
|
||||
try:
|
||||
try:
|
||||
body = body.decode()
|
||||
except (UnicodeDecodeError, AttributeError):
|
||||
pass
|
||||
msg_dict = json.loads(body)
|
||||
api_key = msg_dict["api_key"]
|
||||
callback_url = msg_dict["callback_url"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue