From 7d708ad8a6c0dbc59190526b9497ee854ccc4f8f Mon Sep 17 00:00:00 2001 From: Colin Powell Date: Sun, 21 Jun 2026 22:39:46 -0400 Subject: [PATCH] [templates] Add polling live page for all scrobbles --- PROJECT.org | 19 ++- vrobbler/apps/scrobbles/views.py | 5 + vrobbler/templates/base.html | 1 + .../scrobbles/_scrobble_all_content.html | 146 ++++++++++++++++++ .../scrobbles/scrobble_all_list.html | 146 +----------------- .../templates/scrobbles/scrobble_list.html | 32 +--- 6 files changed, 177 insertions(+), 172 deletions(-) create mode 100644 vrobbler/templates/scrobbles/_scrobble_all_content.html diff --git a/PROJECT.org b/PROJECT.org index 6c6f1f3..ad34b6a 100644 --- a/PROJECT.org +++ b/PROJECT.org @@ -88,7 +88,7 @@ fetching and simple saving. *** Metadata sources **** Scraper -* Backlog [0/23] :vrobbler:project:personal: +* Backlog [3/26] :vrobbler:project:personal: ** TODO [#C] Create small utility to clean up tracks scrobbled with wonky playback times :bug:music:scrobbles: :PROPERTIES: :ID: 702462cf-d54b-48c6-8a7c-78b8de751deb @@ -604,7 +604,22 @@ independent of the email flow it was originally creatdd for ** TODO [#B] Is there way to create unique slugs for media instances :media_types: -** TODO [#C] What would it look like to add an MCP server to expose scrobbles and media items? :mcpserver:feature: +** STRT [#B] Use HTMx to update the Now Playing widget :feature:templates: +:PROPERTIES: +:ID: 5f5631fc-9ee1-d5a5-d0f8-94fea6fbbfa4 +:END: +** DONE [#B] Add a live page that updates the scrobble list via JS polling :feature:templates: +:PROPERTIES: +:ID: 58790d76-dc6e-8aa5-2dc0-e64fe786fbf1 +:END: +** DONE [#A] Turns out we cant cache the now playing widget :bug:templates: +:PROPERTIES: +:ID: 9ce669ea-c000-cdfe-a634-ad5cdaeae81c +:END: +** DONE [#C] What would it look like to add an MCP server to expose scrobbles and media items? :mcpserver:feature: +:PROPERTIES: +:ID: c5fca159-c7e0-5795-7c05-bbc48f539650 +:END: * Version 56.4 [3/3] ** DONE [#B] Add ability to do reverse address lookup on lat-long pairs :geolocations:feature: :PROPERTIES: diff --git a/vrobbler/apps/scrobbles/views.py b/vrobbler/apps/scrobbles/views.py index 18ce5ba..7b2c589 100644 --- a/vrobbler/apps/scrobbles/views.py +++ b/vrobbler/apps/scrobbles/views.py @@ -366,6 +366,11 @@ class ScrobbleListView(LoginRequiredMixin, ListView): paginate_by = 100 template_name = "scrobbles/scrobble_all_list.html" + def get_template_names(self): + if self.request.headers.get("HX-Request"): + return ["scrobbles/_scrobble_all_content.html"] + return ["scrobbles/scrobble_all_list.html"] + def get_queryset(self): qs = Scrobble.objects.filter(user=self.request.user).order_by("-timestamp") tags_param = self.request.GET.get("tags", "") diff --git a/vrobbler/templates/base.html b/vrobbler/templates/base.html index af964f5..450ee9a 100644 --- a/vrobbler/templates/base.html +++ b/vrobbler/templates/base.html @@ -13,6 +13,7 @@ +