Add icons for music services

This commit is contained in:
2023-03-04 15:46:26 -05:00
parent 34a2339b3b
commit 2811146656
8 changed files with 36 additions and 2 deletions

View File

@ -77,6 +77,16 @@ class Artist(TimeStampedModel):
img_filename = f"{self.name}_{self.uuid}.jpg"
self.thumbnail.save(img_filename, File(img_temp))
@property
def rym_link(self):
artist_slug = self.name.lower().replace(' ', '-')
return f"https://rateyourmusic.com/artist/{artist_slug}/"
@property
def bandcamp_search_link(self):
artist = self.name.lower()
return f"https://bandcamp.com/search?q={artist}&item_type=b"
class Album(TimeStampedModel):
uuid = models.UUIDField(default=uuid4, editable=False, **BNULL)
@ -246,6 +256,18 @@ class Album(TimeStampedModel):
return f"https://www.theaudiodb.com/album/{self.theaudiodb_id}"
return ""
@property
def rym_link(self):
artist_slug = self.primary_artist.name.lower().replace(' ', '-')
album_slug = self.name.lower().replace(' ', '-')
return f"https://rateyourmusic.com/release/album/{artist_slug}/{album_slug}/"
@property
def bandcamp_search_link(self):
artist = self.primary_artist.name.lower()
album = self.name.lower()
return f"https://bandcamp.com/search?q={album} {artist}&item_type=a"
class Track(ScrobblableMixin):
COMPLETION_PERCENT = getattr(settings, 'MUSIC_COMPLETION_PERCENT', 90)