update changelog

+ minor bugfixes
This commit is contained in:
cwilvx
2025-02-28 20:39:21 +03:00
parent 7aae38ae3b
commit da364d8514
4 changed files with 77 additions and 7 deletions
+3 -1
View File
@@ -313,7 +313,9 @@ class TopResults:
top_result["type"] = "album"
if isinstance(top_result, Artist):
top_result = serialize_for_card(top_result)
top_result = serialize_for_card(
top_result, include={"albumcount", "trackcount"}
)
top_result["type"] = "artist"
return {
+5 -1
View File
@@ -3,7 +3,7 @@ from dataclasses import asdict
from app.models.artist import Artist
def serialize_for_card(artist: Artist):
def serialize_for_card(artist: Artist, include: set[str] = set()):
try:
artist_dict = asdict(artist)
except TypeError:
@@ -25,8 +25,12 @@ def serialize_for_card(artist: Artist):
"created_date",
"date",
"fav_userids",
"_score",
}
if include:
props_to_remove = props_to_remove - include
for key in props_to_remove:
artist_dict.pop(key, None)
+7 -1
View File
@@ -119,7 +119,13 @@ class AlbumStore:
"""
Returns albums by their hashes.
"""
return [cls.albummap[albumhash].album for albumhash in albumhashes]
albums = []
for albumhash in albumhashes:
entry = cls.albummap.get(albumhash)
if entry is not None:
albums.append(entry.album)
return albums
@classmethod
def count_albums_by_artisthash(cls, artisthash: str):