From 4867acb30ba54c276285ac11157d195c543a064f Mon Sep 17 00:00:00 2001 From: Colin Powell Date: Mon, 13 Mar 2023 14:54:11 -0400 Subject: [PATCH] Fix display of covers --- vrobbler/apps/videos/models.py | 7 +++++++ vrobbler/templates/videos/series_detail.html | 6 +++--- vrobbler/templates/videos/video_detail.html | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/vrobbler/apps/videos/models.py b/vrobbler/apps/videos/models.py index b29c581..33ae94d 100644 --- a/vrobbler/apps/videos/models.py +++ b/vrobbler/apps/videos/models.py @@ -50,6 +50,10 @@ class Series(TimeStampedModel): def fix_metadata(self, force_update=False): imdb_dict = lookup_video_from_imdb(self.name, kind="tv series") + if not imdb_dict: + logger.warn(f"No imdb data for {self}") + return + self.imdb_id = imdb_dict.data.get("imdbID") self.imdb_rating = imdb_dict.data.get("arithmetic mean") self.plot = imdb_dict.data.get("plot outline") @@ -125,6 +129,9 @@ class Video(ScrobblableMixin): def fix_metadata(self, force_update=False): imdb_dict = lookup_video_from_imdb(self.imdb_id) + if not imdb_dict: + logger.warn(f"No imdb data for {self}") + return if imdb_dict.get("runtimes") and len(imdb_dict.get("runtimes")) > 0: self.run_time_seconds = int(imdb_dict.get("runtimes")[0]) * 60 self.imdb_rating = imdb_dict.data.get("rating") diff --git a/vrobbler/templates/videos/series_detail.html b/vrobbler/templates/videos/series_detail.html index 941432b..d96cf14 100644 --- a/vrobbler/templates/videos/series_detail.html +++ b/vrobbler/templates/videos/series_detail.html @@ -5,8 +5,8 @@ {% block head_extra %} {% endblock %} @@ -14,7 +14,7 @@
{% if object.cover_image %} -
+
{% endif %}
{% if object.plot%} diff --git a/vrobbler/templates/videos/video_detail.html b/vrobbler/templates/videos/video_detail.html index edebeac..9cbb810 100644 --- a/vrobbler/templates/videos/video_detail.html +++ b/vrobbler/templates/videos/video_detail.html @@ -5,7 +5,7 @@ {% block head_extra %} {% endblock %}