From be16d513ef65387a491efeee81f17ebfcf4d4148 Mon Sep 17 00:00:00 2001 From: Colin Powell Date: Tue, 9 Jun 2026 17:04:59 -0400 Subject: [PATCH] [charts] Add better chart views per Maloja --- PROJECT.org | 23 +- vrobbler/apps/charts/views.py | 200 +++++++++--------- vrobbler/templates/base_list.html | 2 + vrobbler/templates/charts/chart_index.html | 98 ++++----- vrobbler/templates/scrobbles/_top_charts.html | 46 ++-- 5 files changed, 184 insertions(+), 185 deletions(-) diff --git a/PROJECT.org b/PROJECT.org index b49a666..f75d800 100644 --- a/PROJECT.org +++ b/PROJECT.org @@ -88,7 +88,7 @@ fetching and simple saving. *** Metadata sources **** Scraper -* Backlog [0/15] :vrobbler:project:personal: +* Backlog [1/17] :vrobbler:project:personal: ** TODO [#C] Create small utility to clean up tracks scrobbled with wonky playback times :vrobbler:personal:bug:music:scrobbles: :PROPERTIES: :ID: 702462cf-d54b-48c6-8a7c-78b8de751deb @@ -534,6 +534,16 @@ async with the POST data stored in the log["raw_data"] and used by the celery en to go try to enrich the media instance. Should this enrichment fail, tag the scrobble as "enrichment-failed" log a warning and move on. +** TODO [#B] Allow browing a user's favorited media :favorites:feature: +:PROPERTIES: +:ID: 5c2cf004-d01f-4576-9bbb-974235e7408a +:END: + +*** Description + +We should have a global view `/favorites/` that shows the logged in users's +favorited media objects. + ** TODO [#A] Allow updating all a user's scrobble visibility at once :scrobbles:sharing:feature: :PROPERTIES: :ID: 9ed2ec65-bf69-4300-965c-6a7d3ef7ea03 @@ -551,6 +561,17 @@ Additionally, users's should have links in their settings to see what scrobbles are either public, shared or private. Probably this could be done with a ?visbility=<> filter on the /scrobbles/ page. +** DONE [#A] Replace columsn of Top Artists, Tracks and Series with Maloja widget :templates:charts: +:PROPERTIES: +:ID: 3946afb1-932c-46fe-a188-f4c9add1a491 +:END: + + +*** Description + +The tables are fine, but Maloja widgets are better. We should drop the top track table, add top albums +and replace top artists and top tv series with the Maloja style widgets. + * Version 49.1 [1/1] ** DONE [#A] Fix bug with missing default visbility for scrobbles :bug:scrobbles:sharing: :PROPERTIES: diff --git a/vrobbler/apps/charts/views.py b/vrobbler/apps/charts/views.py index a4e9e8a..feed131 100644 --- a/vrobbler/apps/charts/views.py +++ b/vrobbler/apps/charts/views.py @@ -114,108 +114,106 @@ class ChartRecordView(TemplateView): context["current_week"] = current_week context["current_day"] = current_day - if chart_type == "maloja": - context["chart_keys"] = { - "today": "Today", - "week": "This Week", - "month": "This Month", - "year": "This Year", - "all": "All Time", - } + context["chart_keys"] = { + "today": "Today", + "week": "This Week", + "month": "This Month", + "year": "This Year", + "all": "All Time", + } - context["maloja_charts"] = { - "artist": { - "today": list( - self.get_charts_for_period( - user, - "artist", - year=current_year, - month=current_month, - day=current_day, - ) - ), - "week": list( - self.get_charts_for_period( - user, - "artist", - year=current_year, - week=current_week, - ) - ), - "month": list( - self.get_charts_for_period( - user, - "artist", - year=current_year, - month=current_month, - ) - ), - "year": list( - self.get_charts_for_period(user, "artist", year=current_year) - ), - "all": list(self.get_charts_for_period(user, "artist")), - }, - "track": { - "today": list( - self.get_charts_for_period( - user, - "track", - year=current_year, - month=current_month, - day=current_day, - ) - ), - "week": list( - self.get_charts_for_period( - user, "track", year=current_year, week=current_week - ) - ), - "month": list( - self.get_charts_for_period( - user, - "track", - year=current_year, - month=current_month, - ) - ), - "year": list( - self.get_charts_for_period(user, "track", year=current_year) - ), - "all": list(self.get_charts_for_period(user, "track")), - }, - "tv_series": { - "today": list( - self.get_charts_for_period( - user, - "tv_series", - year=current_year, - month=current_month, - day=current_day, - ) - ), - "week": list( - self.get_charts_for_period( - user, - "tv_series", - year=current_year, - week=current_week, - ) - ), - "month": list( - self.get_charts_for_period( - user, - "tv_series", - year=current_year, - month=current_month, - ) - ), - "year": list( - self.get_charts_for_period(user, "tv_series", year=current_year) - ), - "all": list(self.get_charts_for_period(user, "tv_series")), - }, - } - return context + context["maloja_charts"] = { + "artist": { + "today": list( + self.get_charts_for_period( + user, + "artist", + year=current_year, + month=current_month, + day=current_day, + ) + ), + "week": list( + self.get_charts_for_period( + user, + "artist", + year=current_year, + week=current_week, + ) + ), + "month": list( + self.get_charts_for_period( + user, + "artist", + year=current_year, + month=current_month, + ) + ), + "year": list( + self.get_charts_for_period(user, "artist", year=current_year) + ), + "all": list(self.get_charts_for_period(user, "artist")), + }, + "album": { + "today": list( + self.get_charts_for_period( + user, + "album", + year=current_year, + month=current_month, + day=current_day, + ) + ), + "week": list( + self.get_charts_for_period( + user, "album", year=current_year, week=current_week + ) + ), + "month": list( + self.get_charts_for_period( + user, + "album", + year=current_year, + month=current_month, + ) + ), + "year": list( + self.get_charts_for_period(user, "album", year=current_year) + ), + "all": list(self.get_charts_for_period(user, "album")), + }, + "tv_series": { + "today": list( + self.get_charts_for_period( + user, + "tv_series", + year=current_year, + month=current_month, + day=current_day, + ) + ), + "week": list( + self.get_charts_for_period( + user, + "tv_series", + year=current_year, + week=current_week, + ) + ), + "month": list( + self.get_charts_for_period( + user, + "tv_series", + year=current_year, + month=current_month, + ) + ), + "year": list( + self.get_charts_for_period(user, "tv_series", year=current_year) + ), + "all": list(self.get_charts_for_period(user, "tv_series")), + }, + } if not date_param: context["period"] = "current" diff --git a/vrobbler/templates/base_list.html b/vrobbler/templates/base_list.html index a3af28d..a6e1749 100644 --- a/vrobbler/templates/base_list.html +++ b/vrobbler/templates/base_list.html @@ -15,6 +15,7 @@ Charts {% endif %} + {% block grid_view_button %}
{% if view == 'grid' %}
+ {% endblock %} {% block charts_button %}{% endblock %} diff --git a/vrobbler/templates/charts/chart_index.html b/vrobbler/templates/charts/chart_index.html index ec95f58..1ae0ab2 100644 --- a/vrobbler/templates/charts/chart_index.html +++ b/vrobbler/templates/charts/chart_index.html @@ -1,4 +1,5 @@ {% extends "base_list.html" %} +{% load static %} {% block title %}Charts{% if period_str %} - {{ period_str }}{% endif %}{% endblock %} @@ -12,11 +13,46 @@ .nav-tabs { cursor: pointer; } + .image-wrapper { + contain: content; + } + .image-wrapper :hover { + background: rgba(0,0,0,0.3); + } + .caption { + position: fixed; + top: 5px; + left: 5px; + padding: 3px; + font-size: 90%; + color: white; + background: rgba(0,0,0,0.4); + } + .caption-medium { + position: fixed; + top: 5px; + left: 5px; + padding: 3px; + font-size: 75%; + color: white; + background: rgba(0,0,0,0.4); + } + .caption-small { + position: fixed; + top: 5px; + left: 5px; + padding: 3px; + font-size: 60%; + color: white; + background: rgba(0,0,0,0.4); + } {% endblock %} {% block lists %} +{% block grid_view_button %}{% endblock %} +
🎵 Spotify Tracks @@ -24,10 +60,6 @@
-{% if chart_type == "maloja" %} -{% include "scrobbles/_top_charts.html" %} -{% else %} -
@@ -88,43 +120,9 @@
{% endif %} +{% include "scrobbles/_top_charts.html" %} +
- {% if charts.artist %} -
-

🎤 Top Artists

- -
- {% endif %} - - {% if charts.album %} -
-

💿 Top Albums

- -
- {% endif %} - {% if charts.track %}

🎵 Top Tracks

@@ -143,24 +141,6 @@
{% endif %} - {% if charts.tv_series %} -
-

📺 Top TV Series

- -
- {% endif %} - {% if charts.video %}

🎬 Top Videos

@@ -314,6 +294,4 @@
{% endif %} -{% endif %} - {% endblock %} diff --git a/vrobbler/templates/scrobbles/_top_charts.html b/vrobbler/templates/scrobbles/_top_charts.html index a15e91b..0549413 100644 --- a/vrobbler/templates/scrobbles/_top_charts.html +++ b/vrobbler/templates/scrobbles/_top_charts.html @@ -76,44 +76,44 @@
-

🎵 Top Tracks

-