fix: new user recently played data not being shown in homepage

+ fix: weird role labels on new users
+ remove system status tray
+ fix: tinytag removing b prefix on tags
This commit is contained in:
cwilvx
2025-05-31 16:55:42 +03:00
parent 20ebddfcff
commit 18fcd22827
12 changed files with 41 additions and 62 deletions
+1
View File
@@ -18,6 +18,7 @@ class HomepageStore:
Stores the homepage items.
"""
# INFO: map of entry names to entry objects
entries: dict[str, HomepageEntry] = {
"recently_played": RecentlyPlayedHomepageEntry(
title="Recently played",
+7 -1
View File
@@ -4,6 +4,7 @@ from typing import Any
from swingmusic.lib.home.recover_items import recover_items
from swingmusic.models.mix import Mix
class HomepageEntry(ABC):
"""
Base class for all homepage entries.
@@ -70,6 +71,12 @@ class RecentlyPlayedHomepageEntry(HomepageEntry):
super().__init__(title, description)
self.items = {}
def add_new_user(self, userid: int):
"""
Add a new user to the homepage entry.
"""
self.items[userid] = []
def get_items(self, userid: int, limit: int | None = None):
items = self.items.get(userid, [])[:limit]
@@ -115,4 +122,3 @@ class BecauseYouListenedToArtistHomepageEntry(RecentlyPlayedHomepageEntry):
"title": title,
"items": recover_items(items),
}
+1 -2
View File
@@ -198,7 +198,6 @@ class TrackStore:
Returns a list of tracks by their hashes.
"""
hash_set = set(trackhashes)
tracks: list[Track] = []
for trackhash in hash_set:
@@ -209,7 +208,7 @@ class TrackStore:
tracks.append(track)
# sort the tracks in the order of the given trackhashes
if type(trackhashes) == list:
if type(trackhashes) is list:
tracks.sort(key=lambda t: trackhashes.index(t.trackhash))
return tracks