diff --git a/maloja/database/__init__.py b/maloja/database/__init__.py index f1ffc41..cc8aeb9 100644 --- a/maloja/database/__init__.py +++ b/maloja/database/__init__.py @@ -621,9 +621,16 @@ def album_info(dbconn=None,**keys): #scrobbles = get_scrobbles_num(track=track,timerange=alltime()) - c = [e for e in alltimecharts if e["album"] == album][0] - scrobbles = c["scrobbles"] - position = c["rank"] + 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 + + cert = None threshold_gold, threshold_platinum, threshold_diamond = malojaconfig["SCROBBLES_GOLD_ALBUM","SCROBBLES_PLATINUM_ALBUM","SCROBBLES_DIAMOND_ALBUM"] if scrobbles >= threshold_diamond: cert = "diamond"