Handle possible None

master
blank X 2 years ago
parent 85e9d7595d
commit 324bc609ec
  1. 8
      autoytarchive/workers.py

@ -78,9 +78,11 @@ async def _check_video(video):
if error_message:
error_message = error_message[7:]
if error_message.startswith('AUTOYTARCHIVE:'):
new_wait_time = int(error_message.split(':', 1)[1].split(' ', 1)[0]) - int(time.time())
if new_wait_time > 0:
wait_time = new_wait_time
tmp = error_message.split(':', 1)[1].split(' ', 1)[0]
if tmp.isnumeric():
new_wait_time = int(tmp) - int(time.time())
if new_wait_time > 0:
wait_time = new_wait_time
logging.error('Error on video %s: %s', video['yt_videoid'], error_message)
else:
logging.error('Video %s returned status code %s\n%s', video['yt_videoid'], proc.returncode, (stderr + stdout).decode())

Loading…
Cancel
Save