[scrobbles] Add notes_as_str to all datalogs and fix homepage
This commit is contained in:
@ -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):
|
||||
|
||||
@ -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,
|
||||
|
||||
Reference in New Issue
Block a user