From c864f408a12aa0b31a60aed384380448ee7ff5a9 Mon Sep 17 00:00:00 2001 From: Colin Powell Date: Wed, 19 Apr 2023 00:25:25 -0400 Subject: [PATCH] Ooops. Set artist image on actual model --- vrobbler/apps/music/models.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/vrobbler/apps/music/models.py b/vrobbler/apps/music/models.py index 6b96457..1c28ff9 100644 --- a/vrobbler/apps/music/models.py +++ b/vrobbler/apps/music/models.py @@ -39,6 +39,14 @@ class Artist(TimeStampedModel): def __str__(self): return self.name + @property + def primary_image_url(self) -> str: + if self.thumbnail: + return self.thumbnail.url + if self.album_set.first().cover_image: + return self.album_set.first().cover_image.url + return "" + @property def mb_link(self): return f"https://musicbrainz.org/artist/{self.musicbrainz_id}" @@ -170,12 +178,9 @@ class Album(TimeStampedModel): @property def primary_image_url(self) -> str: - url = "" - if self.thumbnail: - url = self.thumbnail.url - if not url and self.album_set.first().cover_image: - url = self.album_set.first().cover_image.url - return url + if self.cover_image.url: + return self.cover_image.url + return "" @property def tracks(self):