1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-24 12:15:40 +01:00

postprocess: return und if we cant get the right language

This commit is contained in:
Johan Andersson 2016-11-27 19:20:41 +01:00
parent a9c579ba5f
commit 80992f8664

View File

@ -40,8 +40,11 @@ class postprocess(object):
try: try:
r = post(url, data=dumps(payload), headers=headers, timeout=30) # Note: reasonable timeout i guess? svtplay-dl is mainly used while multitasking i presume, and it is heroku after all (fast enough) r = post(url, data=dumps(payload), headers=headers, timeout=30) # Note: reasonable timeout i guess? svtplay-dl is mainly used while multitasking i presume, and it is heroku after all (fast enough)
if r.status_code == codes.ok: if r.status_code == codes.ok:
response = r.json() try:
return response['language'] response = r.json()
return response['language']
except TypeError:
return 'und'
else: else:
log.error("Server error appeared. Setting language as undetermined.") log.error("Server error appeared. Setting language as undetermined.")
return 'und' return 'und'