From 29e179adadca32ae75f5077106da552bf61cb373 Mon Sep 17 00:00:00 2001 From: Colin Powell Date: Thu, 2 Apr 2026 11:55:29 -0400 Subject: [PATCH] [scrobbles] Move tags out of org title and into page --- vrobbler/apps/scrobbles/urls.py | 9 +- vrobbler/apps/scrobbles/views.py | 20 ++++ vrobbler/apps/tasks/models.py | 2 +- .../scrobbles/scrobble_all_list.html | 92 +++++++++++++++++++ .../templates/scrobbles/scrobble_detail.html | 9 ++ 5 files changed, 127 insertions(+), 5 deletions(-) create mode 100644 vrobbler/templates/scrobbles/scrobble_all_list.html diff --git a/vrobbler/apps/scrobbles/urls.py b/vrobbler/apps/scrobbles/urls.py index 42dbd8f..84a921b 100644 --- a/vrobbler/apps/scrobbles/urls.py +++ b/vrobbler/apps/scrobbles/urls.py @@ -122,11 +122,12 @@ urlpatterns = [ name="long-plays", ), path( - "scrobble//", + "scrobbles//", views.ScrobbleDetailView.as_view(), name="detail", ), - path("scrobble//start/", views.scrobble_start, name="start"), - path("scrobble//finish/", views.scrobble_finish, name="finish"), - path("scrobble//cancel/", views.scrobble_cancel, name="cancel"), + path("scrobbles//start/", views.scrobble_start, name="start"), + path("scrobbles//finish/", views.scrobble_finish, name="finish"), + path("scrobbles//cancel/", views.scrobble_cancel, name="cancel"), + path("scrobbles/", views.ScrobbleListView.as_view(), name="scrobble-list"), ] diff --git a/vrobbler/apps/scrobbles/views.py b/vrobbler/apps/scrobbles/views.py index b26551a..6dc06b1 100644 --- a/vrobbler/apps/scrobbles/views.py +++ b/vrobbler/apps/scrobbles/views.py @@ -192,6 +192,26 @@ class ScrobbleableDetailView(ChartContextMixin, DetailView): class RecentScrobbleList(ListView): model = Scrobble + +class ScrobbleListView(LoginRequiredMixin, ListView): + model = Scrobble + paginate_by = 100 + template_name = "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", "") + if tags_param: + tag_list = [t.strip() for t in tags_param.split(",") if t.strip()] + if tag_list: + qs = qs.filter(tags__name__in=tag_list).distinct() + return qs + + def get_context_data(self, **kwargs): + ctx = super().get_context_data(**kwargs) + ctx["tags_param"] = self.request.GET.get("tags", "") + return ctx + def get(self, *args, **kwargs): user = self.request.user if user.is_authenticated: diff --git a/vrobbler/apps/tasks/models.py b/vrobbler/apps/tasks/models.py index 6770de5..ecc3fc0 100644 --- a/vrobbler/apps/tasks/models.py +++ b/vrobbler/apps/tasks/models.py @@ -55,7 +55,7 @@ class TaskLogData(BaseLogData): timestamp, note_text = next(iter(note.items())) # Flatten newlines and clean whitespace note_text = " ".join(note_text.strip().split()) - lines.append(f"{timestamp}: {note_text} [{labels_str}]") + lines.append(f"{timestamp}: {note_text}") if isinstance(note, list): lines += note if isinstance(note, str): diff --git a/vrobbler/templates/scrobbles/scrobble_all_list.html b/vrobbler/templates/scrobbles/scrobble_all_list.html new file mode 100644 index 0000000..becbc03 --- /dev/null +++ b/vrobbler/templates/scrobbles/scrobble_all_list.html @@ -0,0 +1,92 @@ +{% extends "base.html" %} +{% load humanize %} +{% load naturalduration %} + +{% block content %} +
+
+

All Scrobbles

+
+ +
+ + + + + + + + + + + {% for scrobble in object_list %} + + + + + + + {% empty %} + + + + {% endfor %} + +
DateTypeTitleTime
{{ scrobble.timestamp|naturaltime }}{{ scrobble.get_media_type_display }} + {% if scrobble.video %} + {{ scrobble.video.title }} + {% elif scrobble.track %} + {{ scrobble.track.title }} + {% elif scrobble.video_game %} + {{ scrobble.video_game.name }} + {% elif scrobble.book %} + {{ scrobble.book.title }} + {% elif scrobble.food %} + {{ scrobble.food.title }} + {% elif scrobble.beer %} + {{ scrobble.beer.title }} + {% elif scrobble.web_page %} + {{ scrobble.web_page.title }} + {% elif scrobble.podcast_episode %} + {{ scrobble.podcast_episode.title }} + {% elif scrobble.board_game %} + {{ scrobble.board_game.name }} + {% elif scrobble.trail %} + {{ scrobble.trail.name }} + {% elif scrobble.puzzle %} + {{ scrobble.puzzle.name }} + {% elif scrobble.brick_set %} + {{ scrobble.brick_set.name }} + {% elif scrobble.task %} + {{ scrobble.task.title }} + {% elif scrobble.life_event %} + {{ scrobble.life_event.title }} + {% elif scrobble.mood %} + {{ scrobble.mood.name }} + {% elif scrobble.geo_location %} + {{ scrobble.geo_location.name }} + {% else %} + Unknown + {% endif %} + + {% if scrobble.playback_position_seconds %} + {{ scrobble.playback_position_seconds|natural_duration }} + {% endif %} +
No scrobbles found.
+
+ + {% if page_obj.has_previous or page_obj.has_next %} + + {% endif %} +
+{% endblock %} diff --git a/vrobbler/templates/scrobbles/scrobble_detail.html b/vrobbler/templates/scrobbles/scrobble_detail.html index fa81091..24451a2 100644 --- a/vrobbler/templates/scrobbles/scrobble_detail.html +++ b/vrobbler/templates/scrobbles/scrobble_detail.html @@ -21,6 +21,15 @@

{{ object.logdata.description }}

{% endif %} +Tags: {{object.tags}} +{% if object.tags.all %} +

+ {% for tag in object.tags.all %} + {{ tag.name }} + {% endfor %} +

+{% endif %} + {% with notes_html=object.logdata.notes_as_html %} {% if notes_html %}