From 61cd63bcc1881c75e77095ca7b1e3b53fc7fa8a8 Mon Sep 17 00:00:00 2001 From: meeb Date: Tue, 15 Feb 2022 17:40:43 +1100 Subject: [PATCH] account for duration in metadata that is set, but has a null value --- tubesync/sync/models.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tubesync/sync/models.py b/tubesync/sync/models.py index 3ac58a4..02ea10e 100644 --- a/tubesync/sync/models.py +++ b/tubesync/sync/models.py @@ -999,7 +999,10 @@ class Media(models.Model): @property def duration(self): field = self.get_metadata_field('duration') - return int(self.loaded_metadata.get(field, 0)) + duration = self.loaded_metadata.get(field, 0) + if not isinstance(duration, int): + duration = 0 + return duration @property def duration_formatted(self):