From ff35f791f69cde82adac6e0aa5e45a2de3452f74 Mon Sep 17 00:00:00 2001 From: meeb Date: Sat, 7 Aug 2021 03:01:44 +1000 Subject: [PATCH] handle media having no metadata at all gracefully, resolves #138 --- tubesync/sync/models.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tubesync/sync/models.py b/tubesync/sync/models.py index d7b6cf79..2a2626c1 100644 --- a/tubesync/sync/models.py +++ b/tubesync/sync/models.py @@ -818,6 +818,20 @@ class Media(models.Model): hdr = '' # If the download has completed use existing values if self.downloaded: + # Check if there's any stored meta data at all + if (not self.downloaded_video_codec and \ + not self.downloaded_audio_codec): + # Marked as downloaded but no metadata, imported? + return { + 'resolution': resolution, + 'height': height, + 'width': width, + 'vcodec': vcodec, + 'acodec': acodec, + 'fps': fps, + 'hdr': hdr, + 'format': tuple(fmt), + } resolution = f'{self.downloaded_height}p' if self.downloaded_format != 'audio': vcodec = self.downloaded_video_codec.lower()