Handle possible None

This commit is contained in:
blank X 2021-01-13 21:18:37 +07:00
parent 85e9d7595d
commit 324bc609ec
1 changed files with 5 additions and 3 deletions

View File

@ -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())