Polish camera settings layout and close media error responses
This commit is contained in:
@@ -343,13 +343,14 @@ def media_json(path, playback=False):
|
||||
with urllib.request.urlopen(req, timeout=5) as r:
|
||||
return json.load(r)
|
||||
except urllib.error.HTTPError as exc:
|
||||
if playback and path.startswith('/list?') and exc.code == 404:
|
||||
try:
|
||||
detail = json.loads(exc.read(4096))
|
||||
if detail.get('error') == 'no recording segments found':
|
||||
return []
|
||||
except (ValueError, AttributeError):
|
||||
pass
|
||||
with exc:
|
||||
if playback and path.startswith('/list?') and exc.code == 404:
|
||||
try:
|
||||
detail = json.loads(exc.read(4096))
|
||||
if detail.get('error') == 'no recording segments found':
|
||||
return []
|
||||
except (ValueError, AttributeError):
|
||||
pass
|
||||
raise Problem('视频服务暂不可用,或该时段尚无可回放录像', 503)
|
||||
except Exception:
|
||||
raise Problem('视频服务暂不可用,或该时段尚无可回放录像', 503)
|
||||
|
||||
Reference in New Issue
Block a user