diff --git a/vrobbler/apps/books/models.py b/vrobbler/apps/books/models.py index 4284baf..7c1f291 100644 --- a/vrobbler/apps/books/models.py +++ b/vrobbler/apps/books/models.py @@ -1,6 +1,5 @@ import logging from datetime import timedelta -from typing import Optional from uuid import uuid4 import requests @@ -85,11 +84,11 @@ class Book(LongPlayScrobblableMixin): return f" by {self.author}" @property - def primary_image(self) -> Optional["ImageField"]: - img = None + def primary_image_url(self) -> str: + url = "" if self.cover: - img = self.cover - return img + url = self.cover.url + return url def get_start_url(self): return reverse("scrobbles:start", kwargs={"uuid": self.uuid}) diff --git a/vrobbler/apps/music/models.py b/vrobbler/apps/music/models.py index b460133..d907fd7 100644 --- a/vrobbler/apps/music/models.py +++ b/vrobbler/apps/music/models.py @@ -389,13 +389,13 @@ class Track(ScrobblableMixin): return self.mb_link @property - def primary_image(self) -> Optional["ImageField"]: - img = None + def primary_image_url(self) -> str: + url = "" if self.artist.thumbnail: - img = self.artist.thumbnail + url = self.artist.thumbnail.url if self.album and self.album.cover_image: - img = self.album.cover_image - return img + url = self.album.cover_image.url + return url @classmethod def find_or_create( diff --git a/vrobbler/apps/podcasts/models.py b/vrobbler/apps/podcasts/models.py index d887eb6..3e28a88 100644 --- a/vrobbler/apps/podcasts/models.py +++ b/vrobbler/apps/podcasts/models.py @@ -96,11 +96,11 @@ class Episode(ScrobblableMixin): return "" @property - def primary_image(self) -> Optional["ImageField"]: - img = None + def primary_image_url(self) -> str: + url = "" if self.podcast.cover_image: - img = self.podcast.cover_image - return img + url = self.podcast.cover_image.url + return url @classmethod def find_or_create( diff --git a/vrobbler/apps/scrobbles/mixins.py b/vrobbler/apps/scrobbles/mixins.py index 2b98548..f68cfdc 100644 --- a/vrobbler/apps/scrobbles/mixins.py +++ b/vrobbler/apps/scrobbles/mixins.py @@ -44,7 +44,7 @@ class ScrobblableMixin(TimeStampedModel): abstract = True @property - def primary_image(self) -> Optional["ImageField"]: + def primary_image_url(self) -> str: logger.warn(f"Not implemented yet") return "" diff --git a/vrobbler/apps/sports/models.py b/vrobbler/apps/sports/models.py index 12e7963..2e987b6 100644 --- a/vrobbler/apps/sports/models.py +++ b/vrobbler/apps/sports/models.py @@ -1,5 +1,5 @@ import logging -from typing import Dict, Optional +from typing import Dict from uuid import uuid4 from django.conf import settings @@ -142,11 +142,11 @@ class SportEvent(ScrobblableMixin): return self.sportsdb_link @property - def primary_image(self) -> Optional["ImageField"]: - img = None + def primary_image_url(self) -> str: + url = "" if self.round.season.league.logo: - img = self.round.season.league.logo - return img + url = self.round.season.league.logo.url + return url @classmethod def find_or_create(cls, data_dict: Dict) -> "Event": diff --git a/vrobbler/apps/videogames/models.py b/vrobbler/apps/videogames/models.py index f3f877d..a1951b1 100644 --- a/vrobbler/apps/videogames/models.py +++ b/vrobbler/apps/videogames/models.py @@ -1,5 +1,4 @@ import logging -from typing import Optional from uuid import uuid4 from django.conf import settings @@ -94,13 +93,13 @@ class VideoGame(LongPlayScrobblableMixin): return f" On {self.platforms.first()}" @property - def primary_image(self) -> Optional["ImageField"]: - img = None + def primary_image_url(self) -> str: + url = "" if self.cover: - img = self.cover + url = self.cover.url if self.hltb_cover: - img = self.hltb_cover - return img + url = self.hltb_cover.url + return url def get_absolute_url(self): return reverse( diff --git a/vrobbler/apps/videos/models.py b/vrobbler/apps/videos/models.py index eaa9208..13f330b 100644 --- a/vrobbler/apps/videos/models.py +++ b/vrobbler/apps/videos/models.py @@ -155,11 +155,11 @@ class Video(ScrobblableMixin): return self.imdb_link @property - def primary_image(self) -> Optional["ImageField"]: - img = None + def primary_image_url(self) -> str: + url = "" if self.cover_image: - img = self.cover_image - return img + url = self.cover_image.url + return url def fix_metadata(self, force_update=False): imdb_dict = lookup_video_from_imdb(self.imdb_id) diff --git a/vrobbler/templates/base.html b/vrobbler/templates/base.html index 088f1a3..01ab88e 100644 --- a/vrobbler/templates/base.html +++ b/vrobbler/templates/base.html @@ -1,6 +1,5 @@ {% load static %} {% load humanize %} -{% load thumbnail %}
@@ -246,11 +245,7 @@ Now playing {% for scrobble in now_playing_list %}