diff --git a/vrobbler/apps/scrobbles/views.py b/vrobbler/apps/scrobbles/views.py index 9e19602..0753946 100644 --- a/vrobbler/apps/scrobbles/views.py +++ b/vrobbler/apps/scrobbles/views.py @@ -98,32 +98,32 @@ class RecentScrobbleList(ListView): user=self.request.user, ) - # 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["chart_keys"] = { - # "today": "Today", - # "last7": "Last 7 days", - # "last30": "Last 30 days", - # "year": "This year", - # "all": "All time", - # } - # data["current_artist_charts"] = { - # "today": list(live_charts(**artist, chart_period="today")), - # "last7": list(live_charts(**artist, chart_period="last7")), - # "last30": list(live_charts(**artist, chart_period="last30")), - # "year": list(live_charts(**artist, chart_period="year")), - # "all": list(live_charts(**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["chart_keys"] = { + "today": "Today", + "last7": "Last 7 days", + "last30": "Last 30 days", + "year": "This year", + "all": "All time", + } + data["current_artist_charts"] = { + "today": list(live_charts(**artist, chart_period="today")), + "last7": list(live_charts(**artist, chart_period="last7")), + "last30": list(live_charts(**artist, chart_period="last30")), + "year": list(live_charts(**artist, chart_period="year")), + "all": list(live_charts(**artist)), + } - # track = {"user": user, "media_type": "Track", "limit": limit} - # data["current_track_charts"] = { - # "today": list(live_charts(**track, chart_period="today")), - # "last7": list(live_charts(**track, chart_period="last7")), - # "last30": list(live_charts(**track, chart_period="last30")), - # "year": list(live_charts(**track, chart_period="year")), - # "all": list(live_charts(**track)), - # } + track = {"user": user, "media_type": "Track", "limit": limit} + data["current_track_charts"] = { + "today": list(live_charts(**track, chart_period="today")), + "last7": list(live_charts(**track, chart_period="last7")), + "last30": list(live_charts(**track, chart_period="last30")), + "year": list(live_charts(**track, chart_period="year")), + "all": list(live_charts(**track)), + } data["counts"] = scrobble_counts(user) else: data["weekly_data"] = week_of_scrobbles() diff --git a/vrobbler/templates/scrobbles/_last_scrobbles.html b/vrobbler/templates/scrobbles/_last_scrobbles.html index 5771696..9e81f30 100644 --- a/vrobbler/templates/scrobbles/_last_scrobbles.html +++ b/vrobbler/templates/scrobbles/_last_scrobbles.html @@ -1,5 +1,8 @@ -

Last Scrobbles

-

Today {{counts.today}} | This Week {{counts.week}} | This Month {{counts.month}} | This Year {{counts.year}} | All Time {{counts.alltime}}

+{% load humanize %} +{% load naturalduration %} +
+

Last Scrobbles

+

Today {{counts.today}} | This Week {{counts.week}} | This Month {{counts.month}} | This Year {{counts.year}} | All Time {{counts.alltime}}

- {% endif %} + diff --git a/vrobbler/templates/scrobbles/_top_charts.html b/vrobbler/templates/scrobbles/_top_charts.html index e054a20..c1c4cb1 100644 --- a/vrobbler/templates/scrobbles/_top_charts.html +++ b/vrobbler/templates/scrobbles/_top_charts.html @@ -1,340 +1,341 @@ -

Top Artist

- +{% load static %} +

Top Artist

+ -
- {% for key, artists in current_artist_charts.items %} -
-
-
-
-
#1 {{artists.0.name}}
- {% if artists.0 %} - {% if artists.0.thumbnail %} - - {% else %} - - {% endif %} - {% endif %} -
-
-
-
-
-
#2 {{artists.1.name}}
- {% if artists.1 %} - {% if artists.1.thumbnail %} - - {% else %} - - {% endif %} - {% endif %} -
-
-
#3 {{artists.2.name}}
- {% if artists.2 %} - {% if artists.2.thumbnail %} - - {% else %} - - {% endif %} - {% endif %} -
-
-
#4 {{artists.3.name}}
- {% if artists.3 %} - {% if artists.3.thumbnail %} - - {% else %} - - {% endif %} - {% endif %} -
-
-
#5 {{artists.4.name}}
- {% if artists.4 %} - {% if artists.4.thumbnail %} - - {% else %} - - {% endif %} - {% endif %} -
-
-
-
-
-
-
#6 {{artists.5.name}}
- {% if artists.5 %} - {% if artists.5.thumbnail %} - - {% else %} - - {% endif %} - {% endif %} -
-
-
#7 {{artists.6.name}}
- {% if artists.6 %} - {% if artists.6.thumbnail %} - - {% else %} - - {% endif %} - {% endif %} -
-
-
#8 {{artists.7.name}}
- {% if artists.7 %} - {% if artists.7.thumbnail %} - - {% else %} - - {% endif %} - {% endif %} -
-
-
#9 {{artists.8.name}}
- {% if artists.8 %} - {% if artists.8.thumbnail %} - - {% else %} - - {% endif %} - {% endif %} -
-
-
#10 {{artists.9.name}}
- {% if artists.9 %} - {% if artists.9.thumbnail %} - - {% else %} - - {% endif %} - {% endif %} -
-
-
#11 {{artists.10.name}}
- {% if artists.10 %} - {% if artists.10.thumbnail %} - - {% else %} - - {% endif %} - {% endif %} -
-
-
#12 {{artists.11.name}}
- {% if artists.11 %} - {% if artists.11.thumbnail %} - - {% else %} - - {% endif %} - {% endif %} -
-
-
#13 {{artists.12.name}}
- {% if artists.12 %} - {% if artists.12.thumbnail %} - - {% else %} - - {% endif %} - {% endif %} -
-
-
#14 {{artists.13.name}}
- {% if artists.13 %} - {% if artists.13.thumbnail %} - - {% else %} - - {% endif %} - {% endif %} -
-
-
+
+ {% for key, artists in current_artist_charts.items %} +
+
+
+
+
#1 {{artists.0.name}}
+ {% if artists.0 %} + {% if artists.0.thumbnail %} + + {% else %} + + {% endif %} + {% endif %} +
+
+
+
+
+
#2 {{artists.1.name}}
+ {% if artists.1 %} + {% if artists.1.thumbnail %} + + {% else %} + + {% endif %} + {% endif %} +
+
+
#3 {{artists.2.name}}
+ {% if artists.2 %} + {% if artists.2.thumbnail %} + + {% else %} + + {% endif %} + {% endif %} +
+
+
#4 {{artists.3.name}}
+ {% if artists.3 %} + {% if artists.3.thumbnail %} + + {% else %} + + {% endif %} + {% endif %} +
+
+
#5 {{artists.4.name}}
+ {% if artists.4 %} + {% if artists.4.thumbnail %} + + {% else %} + + {% endif %} + {% endif %} +
+
+
+
+
+
+
#6 {{artists.5.name}}
+ {% if artists.5 %} + {% if artists.5.thumbnail %} + + {% else %} + + {% endif %} + {% endif %} +
+
+
#7 {{artists.6.name}}
+ {% if artists.6 %} + {% if artists.6.thumbnail %} + + {% else %} + + {% endif %} + {% endif %} +
+
+
#8 {{artists.7.name}}
+ {% if artists.7 %} + {% if artists.7.thumbnail %} + + {% else %} + + {% endif %} + {% endif %} +
+
+
#9 {{artists.8.name}}
+ {% if artists.8 %} + {% if artists.8.thumbnail %} + + {% else %} + + {% endif %} + {% endif %} +
+
+
#10 {{artists.9.name}}
+ {% if artists.9 %} + {% if artists.9.thumbnail %} + + {% else %} + + {% endif %} + {% endif %} +
+
+
#11 {{artists.10.name}}
+ {% if artists.10 %} + {% if artists.10.thumbnail %} + + {% else %} + + {% endif %} + {% endif %} +
+
+
#12 {{artists.11.name}}
+ {% if artists.11 %} + {% if artists.11.thumbnail %} + + {% else %} + + {% endif %} + {% endif %} +
+
+
#13 {{artists.12.name}}
+ {% if artists.12 %} + {% if artists.12.thumbnail %} + + {% else %} + + {% endif %} + {% endif %} +
+
+
#14 {{artists.13.name}}
+ {% if artists.13 %} + {% if artists.13.thumbnail %} + + {% else %} + + {% endif %} + {% endif %}
- {% endfor %}
+
+ {% endfor %} +
+
-
-

Top Tracks

- +
+

Top Tracks

+ -
- {% for chart_name, tracks in current_track_charts.items %} -
-
-
-
-
#1 {{tracks.0.title}}
- {% if tracks.0 %} - {% if tracks.0.album.cover_image %} - - {% else %} - - {% endif %} - {% endif %} -
-
-
-
-
-
#2 {{tracks.1.title}}
- {% if tracks.1 %} - {% if tracks.1.album.cover_image %} - - {% else %} - - {% endif %} - {% endif %} -
-
-
#3 {{tracks.2.title}}
- {% if tracks.2 %} - {% if tracks.2.album.cover_image %} - - {% else %} - - {% endif %} - {% endif %} -
-
-
#4 {{tracks.3.title}}
- {% if tracks.3 %} - {% if tracks.3.album.cover_image %} - - {% else %} - - {% endif %} - {% endif %} -
-
-
#5 {{tracks.4.title}}
- {% if tracks.4 %} - {% if tracks.4.album.cover_image %} - - {% else %} - - {% endif %} - {% endif %} -
-
-
-
-
-
-
#6 {{tracks.5.title}}
- {% if tracks.5 %} - {% if tracks.5.album.cover_image %} - - {% else %} - - {% endif %} - {% endif %} -
-
-
#7 {{tracks.6.title}}
- {% if tracks.6 %} - {% if tracks.6.album.cover_image %} - - {% else %} - - {% endif %} - {% endif %} -
-
-
#8 {{tracks.7.title}}
- {% if tracks.7 %} - {% if tracks.7.album.cover_image %} - - {% else %} - - {% endif %} - {% endif %} -
-
-
#9 {{tracks.8.title}}
- {% if tracks.8 %} - {% if tracks.8.album.cover_image %} - - {% else %} - - {% endif %} - {% endif %} -
-
-
#10 {{tracks.9.title}}
- {% if tracks.9 %} - {% if tracks.9.album.cover_image %} - - {% else %} - - {% endif %} - {% endif %} -
-
-
#11 {{tracks.10.title}}
- {% if tracks.10 %} - {% if tracks.10.album.cover_image %} - - {% else %} - - {% endif %} - {% endif %} -
-
-
#12 {{tracks.11.title}}
- {% if tracks.11 %} - {% if tracks.11.album.cover_image %} - - {% else %} - - {% endif %} - {% endif %} -
-
-
#13 {{tracks.12.title}}
- {% if tracks.12 %} - {% if tracks.12.album.cover_image %} - - {% else %} - - {% endif %} - {% endif %} -
-
-
#14 {{tracks.13.title}}
- {% if tracks.13 %} - {% if tracks.13.album.cover_image %} - - {% else %} - - {% endif %} - {% endif %} -
-
-
+
+ {% for chart_name, tracks in current_track_charts.items %} +
+
+
+
+
#1 {{tracks.0.title}}
+ {% if tracks.0 %} + {% if tracks.0.album.cover_image %} + + {% else %} + + {% endif %} + {% endif %} +
+
+
+
+
+
#2 {{tracks.1.title}}
+ {% if tracks.1 %} + {% if tracks.1.album.cover_image %} + + {% else %} + + {% endif %} + {% endif %} +
+
+
#3 {{tracks.2.title}}
+ {% if tracks.2 %} + {% if tracks.2.album.cover_image %} + + {% else %} + + {% endif %} + {% endif %} +
+
+
#4 {{tracks.3.title}}
+ {% if tracks.3 %} + {% if tracks.3.album.cover_image %} + + {% else %} + + {% endif %} + {% endif %} +
+
+
#5 {{tracks.4.title}}
+ {% if tracks.4 %} + {% if tracks.4.album.cover_image %} + + {% else %} + + {% endif %} + {% endif %}
- {% endfor %}
+
+
+
+
#6 {{tracks.5.title}}
+ {% if tracks.5 %} + {% if tracks.5.album.cover_image %} + + {% else %} + + {% endif %} + {% endif %} +
+
+
#7 {{tracks.6.title}}
+ {% if tracks.6 %} + {% if tracks.6.album.cover_image %} + + {% else %} + + {% endif %} + {% endif %} +
+
+
#8 {{tracks.7.title}}
+ {% if tracks.7 %} + {% if tracks.7.album.cover_image %} + + {% else %} + + {% endif %} + {% endif %} +
+
+
#9 {{tracks.8.title}}
+ {% if tracks.8 %} + {% if tracks.8.album.cover_image %} + + {% else %} + + {% endif %} + {% endif %} +
+
+
#10 {{tracks.9.title}}
+ {% if tracks.9 %} + {% if tracks.9.album.cover_image %} + + {% else %} + + {% endif %} + {% endif %} +
+
+
#11 {{tracks.10.title}}
+ {% if tracks.10 %} + {% if tracks.10.album.cover_image %} + + {% else %} + + {% endif %} + {% endif %} +
+
+
#12 {{tracks.11.title}}
+ {% if tracks.11 %} + {% if tracks.11.album.cover_image %} + + {% else %} + + {% endif %} + {% endif %} +
+
+
#13 {{tracks.12.title}}
+ {% if tracks.12 %} + {% if tracks.12.album.cover_image %} + + {% else %} + + {% endif %} + {% endif %} +
+
+
#14 {{tracks.13.title}}
+ {% if tracks.13 %} + {% if tracks.13.album.cover_image %} + + {% else %} + + {% endif %} + {% endif %} +
+
+
+
+
+ {% endfor %} +
diff --git a/vrobbler/templates/scrobbles/scrobble_list.html b/vrobbler/templates/scrobbles/scrobble_list.html index 1f2c19c..9abd6dd 100644 --- a/vrobbler/templates/scrobbles/scrobble_list.html +++ b/vrobbler/templates/scrobbles/scrobble_list.html @@ -1,6 +1,6 @@ {% extends "base.html" %} -{% load humanize %} {% load static %} +{% load humanize %} {% load naturalduration %} {% block head_extra %} @@ -85,7 +85,6 @@ {% endif %}
- {% if user.is_authenticated %}
{% include "scrobbles/_top_charts.html" %} @@ -94,6 +93,8 @@
{% include "scrobbles/_last_scrobbles.html" %}
+ {% endif %} +