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)

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

View File

@ -1,5 +1,6 @@
{% extends "base_list.html" %}
{% load mathfilters %}
{% load static %}
{% block title %}{{object.name}}{% endblock %}
@ -17,7 +18,13 @@
<p>{{object.theaudiodb_description|safe|linebreaks|truncatewords:160}}</p>
<hr/>
{% endif %}
<p><a href="{{album.mb_link}}">Musicbrainz</a> {% if album.tadb_link %}| <a href="{{album.tadb_link}}">TheAudioDB</a>{% endif %} {% if album.allmusic_link %}| <a href="{{album.allmusic_link}}">AllMusic</a>{% endif %}</p>
<p style="float:right;">
<a href="{{album.mb_link}}"><img src="{% static "images/musicbrainz-logo.png" %}" width=35></a>
<a href="{{album.rym_link}}"><img src="{% static "images/rateyourmusic-logo.jpg" %}" width=35></a>
<a href="{{album.bandcamp_search_link}}"><img src="{% static "images/bandcamp-logo.png" %}" width=35></a>
{% if album.tadb_link %}<a href="{{album.tadb_link}}"><img src="{% static "images/theaudiodb-logo.png" %}" width=35></a>{% endif %}
{% if album.allmusic_link %}<a href="{{album.allmusic_link}}"><img src="{% static "images/allmusic-logo.png" %}" width=35></a>{% endif %}
</p>
</div>
</div>
<div class="row">

View File

@ -1,5 +1,6 @@
{% extends "base_list.html" %}
{% load mathfilters %}
{% load static %}
{% block title %}{{object.name}}{% endblock %}
@ -22,7 +23,11 @@
<p>{{artist.biography|safe|linebreaks|truncatewords:160}}</p>
<hr/>
{% endif %}
<p><a href="{{artist.mb_link}}">Musicbrainz</a></p>
<p style="float:right;">
<a href="{{artist.mb_link}}"><img src="{% static "images/musicbrainz-logo.png" %}" width=35></a>
<a href="{{artist.rym_link}}"><img src="{% static "images/rateyourmusic-logo.jpg" %}" width=35></a>
<a href="{{artist.bandcamp_search_link}}"><img src="{% static "images/bandcamp-logo.png" %}" width=35></a>
</p>
</div>
</div>
<div class="row">