mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-04 20:43:04 +00:00
update changelog
+ minor bugfixes
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user