Handle None in video["duration"]

Fixes #725

Translate `None` from `get` to `0` for `float`
This commit is contained in:
tcely 2025-02-14 14:30:10 -05:00 committed by GitHub
parent f083ad65f7
commit 92c0ed20c7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -213,7 +213,7 @@ def index_source_task(source_id):
except Media.DoesNotExist:
media = Media(key=key)
media.source = source
media.duration = float(video.get(fields('duration', media), 0)) or None
media.duration = float(video.get(fields('duration', media), 0) or 0) or None
media.title = str(video.get(fields('title', media), ''))[:200]
timestamp = video.get(fields('timestamp', media), None)
if timestamp is not None: