From a7100a0f532e45e914126b3a9d941f04fdd7ad3c Mon Sep 17 00:00:00 2001 From: Laurent DEFERT Date: Wed, 28 Dec 2022 19:06:07 +0100 Subject: [PATCH] prevent exceptions when metadata loading failed --- tubesync/sync/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tubesync/sync/models.py b/tubesync/sync/models.py index 93f1d7b..b2aeea5 100644 --- a/tubesync/sync/models.py +++ b/tubesync/sync/models.py @@ -866,7 +866,7 @@ class Media(models.Model): # Otherwise, calculate from matched format codes vformat = None aformat = None - if '+' in format_str: + if format_str and '+' in format_str: # Seperate audio and video streams vformat_code, aformat_code = format_str.split('+') vformat = self.get_format_by_code(vformat_code) @@ -875,7 +875,7 @@ class Media(models.Model): # Combined stream or audio only cformat = self.get_format_by_code(format_str) aformat = cformat - if cformat['vcodec']: + if cformat and cformat['vcodec']: # Combined vformat = cformat if vformat: