From 8d1df806d7b94cfa84f84dad3920fa7c1908f03f Mon Sep 17 00:00:00 2001 From: Colin Powell Date: Mon, 16 Jan 2023 23:46:04 -0500 Subject: [PATCH] Fix IMDB fetch when runtimes are not present --- vrobbler/apps/scrobbles/imdb.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/vrobbler/apps/scrobbles/imdb.py b/vrobbler/apps/scrobbles/imdb.py index 84d13a1..3ee4f86 100644 --- a/vrobbler/apps/scrobbles/imdb.py +++ b/vrobbler/apps/scrobbles/imdb.py @@ -19,7 +19,11 @@ def lookup_video_from_imdb(imdb_id: str) -> dict: lookup_id = imdb_id.strip('tt') media = imdb_client.get_movie(lookup_id) - run_time_seconds = int(media.get('runtimes')[0]) * 60 + run_time_seconds = 60 * 60 + runtimes = media.get("runtimes") + if runtimes: + run_time_seconds = int(runtimes)[0] * 60 + # Ticks otherwise known as miliseconds run_time_ticks = run_time_seconds * 1000 * 1000