Fixed silly error

This commit is contained in:
krateng 2023-10-26 19:26:22 +02:00
parent 8eb495bbaf
commit 964128fdff
2 changed files with 10 additions and 10 deletions

View File

@ -663,8 +663,13 @@ def search(**keys):
'link': "/album?" + compose_querystring(internal_to_uri({"album":al})),
'image': images.get_album_image(al)
}
if not result['album']['artists']: result['album']['displayArtist'] = malojaconfig["DEFAULT_ALBUM_ARTIST"]
albums_result.append(result)
mutable_result = result.copy()
mutable_result['album'] = result['album'].copy()
if not mutable_result['album']['artists']: mutable_result['album']['displayArtist'] = malojaconfig["DEFAULT_ALBUM_ARTIST"]
# we don't wanna actually mutate the dict here because this is in the cache
# TODO: This should be globally solved!!!!! immutable dicts with mutable overlays???
# this is a major flaw in the architecture!
albums_result.append(mutable_result)
return {"artists":artists_result[:max_],"tracks":tracks_result[:max_],"albums":albums_result[:max_]}

View File

@ -721,14 +721,9 @@ def album_info(dbconn=None,**keys):
#scrobbles = get_scrobbles_num(track=track,timerange=alltime())
try:
c = [e for e in alltimecharts if e["album"] == album][0]
scrobbles = c["scrobbles"]
position = c["rank"]
except IndexError as e:
log(f"Error while finding album chart position for {album}",module="debug_special")
log(f"{e}",module="debug_special")
scrobbles, position = 0,0
c = [e for e in alltimecharts if e["album"] == album][0]
scrobbles = c["scrobbles"]
position = c["rank"]
cert = None