From a66113539416b6138efce78db0f0cb0ab19d9ab8 Mon Sep 17 00:00:00 2001 From: Colin Powell Date: Thu, 14 Sep 2023 00:23:12 -0400 Subject: [PATCH] Slim down the homepage --- vrobbler/apps/scrobbles/views.py | 51 +-- vrobbler/templates/scrobbles/_media_box.html | 14 + .../templates/scrobbles/_quick_resume.html | 4 + vrobbler/templates/scrobbles/_top_charts.html | 340 +++++++++++++++++ .../templates/scrobbles/scrobble_list.html | 341 +----------------- 5 files changed, 385 insertions(+), 365 deletions(-) create mode 100644 vrobbler/templates/scrobbles/_media_box.html create mode 100644 vrobbler/templates/scrobbles/_quick_resume.html create mode 100644 vrobbler/templates/scrobbles/_top_charts.html diff --git a/vrobbler/apps/scrobbles/views.py b/vrobbler/apps/scrobbles/views.py index 042901d..2515e2c 100644 --- a/vrobbler/apps/scrobbles/views.py +++ b/vrobbler/apps/scrobbles/views.py @@ -63,6 +63,7 @@ from scrobbles.tasks import ( from scrobbles.utils import ( get_long_plays_completed, get_long_plays_in_progress, + get_recently_played_board_games, ) logger = logging.getLogger(__name__) @@ -79,6 +80,7 @@ class RecentScrobbleList(ListView): played_to_completion=True, user=user ) data["long_play_in_progress"] = get_long_plays_in_progress(user) + data["play_again"] = get_recently_played_board_games(user) data["video_scrobble_list"] = completed_for_user.filter( video__isnull=False ).order_by("-timestamp")[:15] @@ -105,32 +107,32 @@ class RecentScrobbleList(ListView): user=self.request.user, ) - limit = 14 - artist = {"user": user, "media_type": "Artist", "limit": limit} + # 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)), - } + # 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() @@ -396,7 +398,6 @@ def scrobble_start(request, uuid): success_url = request.META.get("HTTP_REFERER") if not user.is_authenticated: - return HttpResponseRedirect(success_url) media_obj = None diff --git a/vrobbler/templates/scrobbles/_media_box.html b/vrobbler/templates/scrobbles/_media_box.html new file mode 100644 index 0000000..b049d31 --- /dev/null +++ b/vrobbler/templates/scrobbles/_media_box.html @@ -0,0 +1,14 @@ +
+
+
{{media.title}}
+ {% if media.hltb_cover %} +
+ {% elif media.cover %} +
+ {% endif %} +
+ {% if media.is_long_play_in_progress %}Playing{% else %}Resume{% endif %} + Finish +
+
+
diff --git a/vrobbler/templates/scrobbles/_quick_resume.html b/vrobbler/templates/scrobbles/_quick_resume.html new file mode 100644 index 0000000..c2a9eb7 --- /dev/null +++ b/vrobbler/templates/scrobbles/_quick_resume.html @@ -0,0 +1,4 @@ +

Quick resume

+{% for media in long_play_in_progress.active %} + {% include "scrobbles/_media_box.html" with media=media%} +{% endfor %} diff --git a/vrobbler/templates/scrobbles/_top_charts.html b/vrobbler/templates/scrobbles/_top_charts.html new file mode 100644 index 0000000..833bc71 --- /dev/null +++ b/vrobbler/templates/scrobbles/_top_charts.html @@ -0,0 +1,340 @@ +

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 %} +
+
+
+
+
+ {% endfor %} +
+ + +
+

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 %} +
+
+
+
+
+ {% endfor %} +
diff --git a/vrobbler/templates/scrobbles/scrobble_list.html b/vrobbler/templates/scrobbles/scrobble_list.html index c6424c5..ad2309d 100644 --- a/vrobbler/templates/scrobbles/scrobble_list.html +++ b/vrobbler/templates/scrobbles/scrobble_list.html @@ -88,346 +88,7 @@ {% if user.is_authenticated %}
-

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 %} -
-
-
-
-
- {% endfor %} -
-
- -
-

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 %} -
-
-
-
-
- {% endfor %} -
+ {% include "scrobbles/_quick_resume.html" %}