diff --git a/maloja/apis/native_v1.py b/maloja/apis/native_v1.py index 58c2a8f..387df6b 100644 --- a/maloja/apis/native_v1.py +++ b/maloja/apis/native_v1.py @@ -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_]} diff --git a/maloja/database/__init__.py b/maloja/database/__init__.py index bfbfea0..89bfe06 100644 --- a/maloja/database/__init__.py +++ b/maloja/database/__init__.py @@ -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