Compare commits

..

3 Commits

Author SHA1 Message Date
34a2339b3b Bump version to 0.11.12 2023-03-03 21:56:32 -05:00
34abbe753b Fix a few display issues with charts 2023-03-03 21:55:36 -05:00
0fe00c3dd8 Fix bug in album creation 2023-03-03 21:55:26 -05:00
4 changed files with 69 additions and 70 deletions

View File

@ -1,6 +1,6 @@
[tool.poetry]
name = "vrobbler"
version = "0.11.11"
version = "0.11.12"
description = ""
authors = ["Colin Powell <colin@unbl.ink>"]

View File

@ -52,13 +52,11 @@ def get_or_create_album(name: str, artist: Artist, mbid: str = None) -> Album:
if not album:
album = Album.objects.create(name=name, musicbrainz_id=mbid)
album.year = album_dict["year"]
album.musicbrainz_id = album_dict["mb_id"]
album.musicbrainz_releasegroup_id = album_dict["mb_group_id"]
album.musicbrainz_albumartist_id = artist.musicbrainz_id
album.save(
update_fields=[
"year",
"musicbrainz_id",
"musicbrainz_releasegroup_id",
"musicbrainz_albumartist_id",
]

View File

@ -90,23 +90,24 @@ class RecentScrobbleList(ListView):
user=self.request.user,
)
l = 14
artist = {'user': user, 'media_type': 'Artist'}
limit = 14
artist = {'user': user, 'media_type': 'Artist', 'limit': limit}
# This is weird. They don't display properly as QuerySets, so we cast to lists
data['current_artist_charts'] = {
"today": live_charts(**artist, chart_period="today", limit=l),
"week": live_charts(**artist, chart_period="week", limit=l),
"month": live_charts(**artist, chart_period="month", limit=l),
"year": live_charts(**artist, chart_period="year", limit=l),
"all": live_charts(**artist, limit=l),
"today": list(live_charts(**artist, chart_period="today")),
"week": list(live_charts(**artist, chart_period="week")),
"month": list(live_charts(**artist, chart_period="month")),
"year": list(live_charts(**artist, chart_period="year")),
"all": list(live_charts(**artist)),
}
track = {'user': user, 'media_type': 'Track'}
track = {'user': user, 'media_type': 'Track', 'limit': limit}
data['current_track_charts'] = {
"today": live_charts(**track, chart_period="today", limit=l),
"week": live_charts(**track, chart_period="week", limit=l),
"month": live_charts(**track, chart_period="month", limit=l),
"year": live_charts(**track, chart_period="year", limit=l),
"all": live_charts(**track, limit=l),
"today": list(live_charts(**track, chart_period="today")),
"week": list(live_charts(**track, chart_period="week")),
"month": list(live_charts(**track, chart_period="month")),
"year": list(live_charts(**track, chart_period="year")),
"all": list(live_charts(**track)),
}
data["weekly_data"] = week_of_scrobbles(user=user)

View File

@ -118,31 +118,31 @@
{% if artists.1.thumbnail %}
<a href="{{artists.1.get_absolute_url}}"><img lt="{{artists.1.name}}" src="{{artists.1.thumbnail.url}}" width="150px"></a>
{% else %}
<a href="{{artists.1.get_absolute_url}}"><img lt="{{artists.1.name}}" src="{% static "images/artist-placeholder.jpg" %}" width="150px"></a>
<a href="{{artists.1.get_absolute_url}}"><img src="{% static "images/artist-placeholder.jpg" %}" width="150px"></a>
{% endif %}
</div>
<div class="image-wrapper" class="image-wrapper" style="width:50%">
<div class="caption-medium">#3 {{artists.2.name}}</div>
{% if artists.2.thumbnail %}
<a href="{{artists.2.get_absolute_url}}"><img lt="{{artists.2.name}}" src="{{artists.2.thumbnail.url}}" width="150px"></a>
<a href="{{artists.2.get_absolute_url}}"><img src="{{artists.2.thumbnail.url}}" width="150px"></a>
{% else %}
<a href="{{artists.2.get_absolute_url}}"><img lt="{{artists.2.name}}" src="{% static "images/artist-placeholder.jpg" %}" width="150px"></a>
<a href="{{artists.2.get_absolute_url}}"><img src="{% static "images/artist-placeholder.jpg" %}" width="150px"></a>
{% endif %}
</div>
<div class="image-wrapper" class="image-wrapper" style="width:50%">
<div class="caption-medium">#4 {{artists.3.name}}</div>
{% if artists.3.thumbnail %}
<a href="{{artists.3.get_absolute_url}}"><img lt="{{artists.3.name}}" src="{{artists.3.thumbnail.url}}" width="150px"></a>
<a href="{{artists.3.get_absolute_url}}"><img src="{{artists.3.thumbnail.url}}" width="150px"></a>
{% else %}
<a href="{{artists.3.get_absolute_url}}"><img lt="{{artists.3.name}}" src="{% static "images/artist-placeholder.jpg" %}" width="150px"></a>
<a href="{{artists.3.get_absolute_url}}"><img src="{% static "images/artist-placeholder.jpg" %}" width="150px"></a>
{% endif %}
</div>
<div class="image-wrapper" class="image-wrapper" style="width:50%">
<div class="caption-medium">#5 {{artists.4.name}}</div>
{% if artists.4.thumbnail %}
<a href="{{artists.4.get_absolute_url}}"><img lt="{{artists.4.name}}" src="{{artists.4.thumbnail.url}}" width="150px"></a>
<a href="{{artists.4.get_absolute_url}}"><img src="{{artists.4.thumbnail.url}}" width="150px"></a>
{% else %}
<a href="{{artists.4.get_absolute_url}}"><img lt="{{artists.4.name}}" src="{% static "images/artist-placeholder.jpg" %}" width="150px"></a>
<a href="{{artists.4.get_absolute_url}}"><img src="{% static "images/artist-placeholder.jpg" %}" width="150px"></a>
{% endif %}
</div>
</div>
@ -152,73 +152,73 @@
<div class="image-wrapper" class="image-wrapper" class="image-wrapper" style="width:33;">
<div class="caption-small">#6 {{artists.5.name}}</div>
{% if artists.5.thumbnail %}
<a href="{{artists.5.get_absolute_url}}"><img lt="{{artists.5.name}}" src="{{artists.5.thumbnail.url}}" width="100px"></a>
<a href="{{artists.5.get_absolute_url}}"><img src="{{artists.5.thumbnail.url}}" width="100px"></a>
{% else %}
<a href="{{artists.5.get_absolute_url}}"><img lt="{{artists.5.name}}" src="{% static "images/artist-placeholder.jpg" %}" width="100px"></a>
<a href="{{artists.5.get_absolute_url}}"><img src="{% static "images/artist-placeholder.jpg" %}" width="100px"></a>
{% endif %}
</div>
<div class="image-wrapper" class="image-wrapper" style="width:33;">
<div class="caption-small">#7 {{artists.6.name}}</div>
{% if artists.6.thumbnail %}
<a href="{{artists.6.get_absolute_url}}"><img lt="{{artists.6.name}}" src="{{artists.6.thumbnail.url}}" width="100px"></a>
<a href="{{artists.6.get_absolute_url}}"><img src="{{artists.6.thumbnail.url}}" width="100px"></a>
{% else %}
<a href="{{artists.6.get_absolute_url}}"><img lt="{{artists.6.name}}" src="{% static "images/artist-placeholder.jpg" %}" width="100px"></a>
<a href="{{artists.6.get_absolute_url}}"><img src="{% static "images/artist-placeholder.jpg" %}" width="100px"></a>
{% endif %}
</div>
<div class="image-wrapper" class="image-wrapper" style="width:33;">
<div class="caption-small">#8 {{artists.7.name}}</div>
{% if artists.7.thumbnail %}
<a href="{{artists.7.get_absolute_url}}"><img lt="{{artists.7.name}}" src="{{artists.7.thumbnail.url}}" width="100px"></a>
<a href="{{artists.7.get_absolute_url}}"><img src="{{artists.7.thumbnail.url}}" width="100px"></a>
{% else %}
<a href="{{artists.7.get_absolute_url}}"><img lt="{{artists.7.name}}" src="{% static "images/artist-placeholder.jpg" %}" width="100px"></a>
<a href="{{artists.7.get_absolute_url}}"><img src="{% static "images/artist-placeholder.jpg" %}" width="100px"></a>
{% endif %}
</div>
<div class="image-wrapper" class="image-wrapper" style="width:33;">
<div class="caption-small">#9 {{artists.8.name}}</div>
{% if artists.8.thumbnail %}
<a href="{{artists.8.get_absolute_url}}"><img lt="{{artists.8.name}}" src="{{artists.8.thumbnail.url}}" width="100px"></a>
<a href="{{artists.8.get_absolute_url}}"><img src="{{artists.8.thumbnail.url}}" width="100px"></a>
{% else %}
<a href="{{artists.8.get_absolute_url}}"><img lt="{{artists.8.name}}" src="{% static "images/artist-placeholder.jpg" %}" width="100px"></a>
<a href="{{artists.8.get_absolute_url}}"><img src="{% static "images/artist-placeholder.jpg" %}" width="100px"></a>
{% endif %}
</div>
<div class="image-wrapper" class="image-wrapper" style="width:33;">
<div class="caption-small">#10 {{artists.9.name}}</div>
{% if artists.9.thumbnail %}
<a href="{{artists.9.get_absolute_url}}"><img lt="{{artists.9.name}}" src="{{artists.9.thumbnail.url}}" width="100px"></a>
<a href="{{artists.9.get_absolute_url}}"><img src="{{artists.9.thumbnail.url}}" width="100px"></a>
{% else %}
<a href="{{artists.9.get_absolute_url}}"><img lt="{{artists.9.name}}" src="{% static "images/artist-placeholder.jpg" %}" width="100px"></a>
<a href="{{artists.9.get_absolute_url}}"><img src="{% static "images/artist-placeholder.jpg" %}" width="100px"></a>
{% endif %}
</div>
<div class="image-wrapper" class="image-wrapper" style="width:33;">
<div class="caption-small">#11 {{artists.10.name}}</div>
{% if artists.10.thumbnail %}
<a href="{{artists.10.get_absolute_url}}"><img lt="{{artists.10.name}}" src="{{artists.10.thumbnail.url}}" width="100px"></a>
<a href="{{artists.10.get_absolute_url}}"><img src="{{artists.10.thumbnail.url}}" width="100px"></a>
{% else %}
<a href="{{artists.10.get_absolute_url}}"><img lt="{{artists.10.name}}" src="{% static "images/artist-placeholder.jpg" %}" width="100px"></a>
<a href="{{artists.10.get_absolute_url}}"><img src="{% static "images/artist-placeholder.jpg" %}" width="100px"></a>
{% endif %}
</div>
<div class="image-wrapper" class="image-wrapper" style="width:33;">
<div class="caption-small">#12 {{artists.11.name}}</div>
{% if artists.11.thumbnail %}
<a href="{{artists.11.get_absolute_url}}"><img lt="{{artists.11.name}}" src="{{artists.11.thumbnail.url}}" width="100px"></a>
<a href="{{artists.11.get_absolute_url}}"><img src="{{artists.11.thumbnail.url}}" width="100px"></a>
{% else %}
<a href="{{artists.11.get_absolute_url}}"><img lt="{{artists.11.name}}" src="{% static "images/artist-placeholder.jpg" %}" width="100px"></a>
<a href="{{artists.11.get_absolute_url}}"><img src="{% static "images/artist-placeholder.jpg" %}" width="100px"></a>
{% endif %}
</div>
<div class="image-wrapper" class="image-wrapper" style="width:33;">
<div class="caption-small">#13 {{artists.12.name}}</div>
{% if artists.12thumbnail %}
<a href="{{artists.12.get_absolute_url}}"><img lt="{{artists.12.name}}" src="{{artists.12.thumbnail.url}}" width="100px"></a>
{% if artists.12.thumbnail %}
<a href="{{artists.12.get_absolute_url}}"><img src="{{artists.12.thumbnail.url}}" width="100px"></a>
{% else %}
<a href="{{artists.12.get_absolute_url}}"><img lt="{{artists.12.name}}" src="{% static "images/artist-placeholder.jpg" %}" width="100px"></a>
<a href="{{artists.12.get_absolute_url}}"><img src="{% static "images/artist-placeholder.jpg" %}" width="100px"></a>
{% endif %}
</div>
<div class="image-wrapper" class="image-wrapper" style="width:33;">
<div class="caption-small">#14 {{artists.13.name}}</div>
{% if artists.13.thumbnail %}
<a href="{{artists.13.get_absolute_url}}"><img lt="{{artists.13.name}}" src="{{artists.13.thumbnail.url}}" width="100px"></a>
<a href="{{artists.13.get_absolute_url}}"><img src="{{artists.13.thumbnail.url}}" width="100px"></a>
{% else %}
<a href="{{artists.13.get_absolute_url}}"><img lt="{{artists.13.name}}" src="{% static "images/artist-placeholder.jpg" %}" width="100px"></a>
<a href="{{artists.13.get_absolute_url}}"><img src="{% static "images/artist-placeholder.jpg" %}" width="100px"></a>
{% endif %}
</div>
</div>
@ -250,9 +250,9 @@
<div class="image-wrapper" style="display:flex; flex-wrap: wrap; margin:0">
<div class="caption">#1 {{tracks.0.title}}</div>
{% if tracks.0.album.cover_image %}
<a href="{{tracks.0.get_absolute_url}}"><img lt="{{tracks.0.title}}" src="{{tracks.0.album.cover_image.url}}" width="300px"></a>
<a href="{{tracks.0.get_absolute_url}}"><img src="{{tracks.0.album.cover_image.url}}" width="300px"></a>
{% else %}
<a href="{{tracks.0.get_absolute_url}}"><img lt="{{tracks.0.title}}" src="{% static 'images/track-placeholder.jpg' %}" width="300px"></a>
<a href="{{tracks.0.get_absolute_url}}"><img src="{% static 'images/track-placeholder.jpg' %}" width="300px"></a>
{% endif %}
</div>
</div>
@ -261,33 +261,33 @@
<div class="image-wrapper" style="width:50%">
<div class="caption-medium">#2 {{tracks.1.title}}</div>
{% if tracks.1.album.cover_image %}
<a href="{{tracks.1.get_absolute_url}}"><img lt="{{tracks.1.title}}" src="{{tracks.1.album.cover_image.url}}" width="150px"></a>
<a href="{{tracks.1.get_absolute_url}}"><img src="{{tracks.1.album.cover_image.url}}" width="150px"></a>
{% else %}
<a href="{{tracks.1.get_absolute_url}}"><img lt="{{tracks.1.title}}" src="{% static 'images/track-placeholder.jpg' %}" width="150px"></a>
<a href="{{tracks.1.get_absolute_url}}"><img src="{% static 'images/track-placeholder.jpg' %}" width="150px"></a>
{% endif %}
</div>
<div class="image-wrapper" style="width:50%">
<div class="caption-medium">#3 {{tracks.2.title}}</div>
{% if tracks.2.album.cover_image %}
<a href="{{tracks.2.get_absolute_url}}"><img lt="{{tracks.2.title}}" src="{{tracks.2.album.cover_image.url}}" width="150px"></a>
<a href="{{tracks.2.get_absolute_url}}"><img src="{{tracks.2.album.cover_image.url}}" width="150px"></a>
{% else %}
<a href="{{tracks.2.get_absolute_url}}"><img lt="{{tracks.2.title}}" src="{% static 'images/track-placeholder.jpg' %}" width="150px"></a>
<a href="{{tracks.2.get_absolute_url}}"><img src="{% static 'images/track-placeholder.jpg' %}" width="150px"></a>
{% endif %}
</div>
<div class="image-wrapper" style="width:50%">
<div class="caption-medium">#4 {{tracks.3.title}}</div>
{% if tracks.3.album.cover_image %}
<a href="{{tracks.3.get_absolute_url}}"><img lt="{{tracks.3.title}}" src="{{tracks.3.album.cover_image.url}}" width="150px"></a>
<a href="{{tracks.3.get_absolute_url}}"><img src="{{tracks.3.album.cover_image.url}}" width="150px"></a>
{% else %}
<a href="{{tracks.3.get_absolute_url}}"><img lt="{{tracks.3.title}}" src="{% static 'images/track-placeholder.jpg' %}" width="150px"></a>
<a href="{{tracks.3.get_absolute_url}}"><img src="{% static 'images/track-placeholder.jpg' %}" width="150px"></a>
{% endif %}
</div>
<div class="image-wrapper" style="width:50%">
<div class="caption-medium">#5 {{tracks.4.title}}</div>
{% if tracks.4.album.cover_image %}
<a href="{{tracks.4.get_absolute_url}}"><img lt="{{tracks.4.title}}" src="{{tracks.4.album.cover_image.url}}" width="150px"></a>
<a href="{{tracks.4.get_absolute_url}}"><img src="{{tracks.4.album.cover_image.url}}" width="150px"></a>
{% else %}
<a href="{{tracks.4.get_absolute_url}}"><img lt="{{tracks.4.title}}" src="{% static 'images/track-placeholder.jpg' %}" width="150px"></a>
<a href="{{tracks.4.get_absolute_url}}"><img src="{% static 'images/track-placeholder.jpg' %}" width="150px"></a>
{% endif %}
</div>
</div>
@ -297,73 +297,73 @@
<div class="image-wrapper" class="image-wrapper" style="width:33;">
<div class="caption-small">#6 {{tracks.5.title}}</div>
{% if tracks.5.album.cover_image %}
<a href="{{tracks.5.get_absolute_url}}"><img lt="{{tracks.5.title}}" src="{{tracks.5.album.cover_image.url}}" width="100px"></a>
<a href="{{tracks.5.get_absolute_url}}"><img src="{{tracks.5.album.cover_image.url}}" width="100px"></a>
{% else %}
<a href="{{tracks.5.get_absolute_url}}"><img lt="{{tracks.5.title}}" src="{% static 'images/track-placeholder.jpg' %}" width="100px"></a>
<a href="{{tracks.5.get_absolute_url}}"><img src="{% static 'images/track-placeholder.jpg' %}" width="100px"></a>
{% endif %}
</div>
<div class="image-wrapper" class="image-wrapper" style="width:33;">
<div class="caption-small">#7 {{tracks.6.title}}</div>
{% if tracks.6.album.cover_image %}
<a href="{{tracks.6.get_absolute_url}}"><img lt="{{tracks.6.title}}" src="{{tracks.6.album.cover_image.url}}" width="100px"></a>
<a href="{{tracks.6.get_absolute_url}}"><img src="{{tracks.6.album.cover_image.url}}" width="100px"></a>
{% else %}
<a href="{{tracks.6.get_absolute_url}}"><img lt="{{tracks.6.title}}" src="{% static 'images/track-placeholder.jpg' %}" width="100px"></a>
<a href="{{tracks.6.get_absolute_url}}"><img src="{% static 'images/track-placeholder.jpg' %}" width="100px"></a>
{% endif %}
</div>
<div class="image-wrapper" class="image-wrapper" style="width:33;">
<div class="caption-small">#8 {{tracks.7.title}}</div>
{% if tracks.7.album.cover_image %}
<a href="{{tracks.7.get_absolute_url}}"><img lt="{{tracks.7.title}}" src="{{tracks.7.album.cover_image.url}}" width="100px"></a>
<a href="{{tracks.7.get_absolute_url}}"><img src="{{tracks.7.album.cover_image.url}}" width="100px"></a>
{% else %}
<a href="{{tracks.7.get_absolute_url}}"><img lt="{{tracks.7.title}}" src="{% static 'images/track-placeholder.jpg' %}" width="100px"></a>
<a href="{{tracks.7.get_absolute_url}}"><img src="{% static 'images/track-placeholder.jpg' %}" width="100px"></a>
{% endif %}
</div>
<div class="image-wrapper" class="image-wrapper" style="width:33;">
<div class="caption-small">#9 {{tracks.8.title}}</div>
{% if tracks.8.album.cover_image %}
<a href="{{tracks.8.get_absolute_url}}"><img lt="{{tracks.8.title}}" src="{{tracks.8.album.cover_image.url}}" width="100px"></a>
<a href="{{tracks.8.get_absolute_url}}"><img src="{{tracks.8.album.cover_image.url}}" width="100px"></a>
{% else %}
<a href="{{tracks.8.get_absolute_url}}"><img lt="{{tracks.8.title}}" src="{% static 'images/track-placeholder.jpg' %}" width="100px"></a>
<a href="{{tracks.8.get_absolute_url}}"><img src="{% static 'images/track-placeholder.jpg' %}" width="100px"></a>
{% endif %}
</div>
<div class="image-wrapper" class="image-wrapper" style="width:33;">
<div class="caption-small">#10 {{tracks.9.title}}</div>
{% if tracks.9.album.cover_image %}
<a href="{{tracks.9.get_absolute_url}}"><img lt="{{tracks.9.title}}" src="{{tracks.9.album.cover_image.url}}" width="100px"></a>
<a href="{{tracks.9.get_absolute_url}}"><img src="{{tracks.9.album.cover_image.url}}" width="100px"></a>
{% else %}
<a href="{{tracks.9.get_absolute_url}}"><img lt="{{tracks.9.title}}" src="{% static 'images/track-placeholder.jpg' %}" width="100px"></a>
<a href="{{tracks.9.get_absolute_url}}"><img src="{% static 'images/track-placeholder.jpg' %}" width="100px"></a>
{% endif %}
</div>
<div class="image-wrapper" class="image-wrapper" style="width:33;">
<div class="caption-small">#11 {{tracks.10.title}}</div>
{% if tracks.10.album.cover_image %}
<a href="{{tracks.10.get_absolute_url}}"><img lt="{{tracks.10.title}}" src="{{tracks.10.album.cover_image.url}}" width="100px"></a>
<a href="{{tracks.10.get_absolute_url}}"><img src="{{tracks.10.album.cover_image.url}}" width="100px"></a>
{% else %}
<a href="{{tracks.10.get_absolute_url}}"><img lt="{{tracks.10.title}}" src="{% static 'images/track-placeholder.jpg' %}" width="100px"></a>
<a href="{{tracks.10.get_absolute_url}}"><img src="{% static 'images/track-placeholder.jpg' %}" width="100px"></a>
{% endif %}
</div>
<div class="image-wrapper" class="image-wrapper" style="width:33;">
<div class="caption-small">#12 {{tracks.11.title}}</div>
{% if tracks.11.album.cover_image %}
<a href="{{tracks.11.get_absolute_url}}"><img lt="{{tracks.11.title}}" src="{{tracks.11.album.cover_image.url}}" width="100px"></a>
<a href="{{tracks.11.get_absolute_url}}"><img src="{{tracks.11.album.cover_image.url}}" width="100px"></a>
{% else %}
<a href="{{tracks.11.get_absolute_url}}"><img lt="{{tracks.11.title}}" src="{% static 'images/track-placeholder.jpg' %}" width="100px"></a>
<a href="{{tracks.11.get_absolute_url}}"><img src="{% static 'images/track-placeholder.jpg' %}" width="100px"></a>
{% endif %}
</div>
<div class="image-wrapper" class="image-wrapper" style="width:33;">
<div class="caption-small">#13 {{tracks.12.title}}</div>
{% if tracks.12.album.cover_image %}
<a href="{{tracks.12.get_absolute_url}}"><img lt="{{tracks.12.title}}" src="{{tracks.12.album.cover_image.url}}" width="100px"></a>
<a href="{{tracks.12.get_absolute_url}}"><img src="{{tracks.12.album.cover_image.url}}" width="100px"></a>
{% else %}
<a href="{{tracks.12.get_absolute_url}}"><img lt="{{tracks.12.title}}" src="{% static 'images/track-placeholder.jpg' %}" width="100px"></a>
<a href="{{tracks.12.get_absolute_url}}"><img src="{% static 'images/track-placeholder.jpg' %}" width="100px"></a>
{% endif %}
</div>
<div class="image-wrapper" class="image-wrapper" style="width:33;">
<div class="caption-small">#14 {{tracks.13.title}}</div>
{% if tracks.13.album.cover_image %}
<a href="{{tracks.13.get_absolute_url}}"><img lt="{{tracks.13.title}}" src="{{tracks.13.album.cover_image.url}}" width="100px"></a>
<a href="{{tracks.13.get_absolute_url}}"><img src="{{tracks.13.album.cover_image.url}}" width="100px"></a>
{% else %}
<a href="{{tracks.13.get_absolute_url}}"><img lt="{{tracks.13.title}}" src="{% static 'images/track-placeholder.jpg' %}" width="100px"></a>
<a href="{{tracks.13.get_absolute_url}}"><img src="{% static 'images/track-placeholder.jpg' %}" width="100px"></a>
{% endif %}
</div>
</div>