[scrobbles] Add notes_as_str to all datalogs and fix homepage

This commit is contained in:
2026-03-13 17:56:39 -04:00
parent 31d3a85e8c
commit 14e32dae12
2 changed files with 19 additions and 0 deletions

View File

@ -49,6 +49,23 @@ class BaseLogData(JSONDataclass):
def override_fields(cls) -> dict:
return {}
def notes_as_str(self) -> str:
note_str = ""
if not self.notes:
return note_str
if self.notes:
if isinstance(self.notes, str):
note_str = self.notes.encode("utf-8").decode("unicode_escape")
if isinstance(self.notes, list):
note_str = (
"\n".join(self.notes)
.encode("utf-8")
.decode("unicode_escape")
)
return note_str
@dataclass
class LongPlayLogData(JSONDataclass):

View File

@ -23,6 +23,8 @@ from django.views.generic.list import ListView
from moods.models import Mood
from music.aggregators import (
artist_scrobble_count,
week_of_scrobbles,
scrobble_counts,
live_charts,
live_tv_charts,
live_youtube_channel_charts,