Fix GH-341

This commit is contained in:
krateng 2024-05-05 16:48:44 +02:00
parent 33ed2abdea
commit 152e3948a1
3 changed files with 6 additions and 3 deletions

View File

@ -444,10 +444,11 @@ def get_charts_albums(dbconn=None,resolve_ids=True,only_own_albums=False,**keys)
(since,to) = keys.get('timerange').timestamps()
if 'artist' in keys:
result = sqldb.count_scrobbles_by_album_combined(since=since,to=to,artist=keys['artist'],associated=keys.get('associated',False),resolve_ids=resolve_ids,dbconn=dbconn)
artist = sqldb.get_artist(sqldb.get_artist_id(keys['artist']))
result = sqldb.count_scrobbles_by_album_combined(since=since,to=to,artist=artist,associated=keys.get('associated',False),resolve_ids=resolve_ids,dbconn=dbconn)
if only_own_albums:
# TODO: this doesnt take associated into account and doesnt change ranks
result = [e for e in result if keys['artist'] in (e['album']['artists'] or [])]
result = [e for e in result if artist in (e['album']['artists'] or [])]
else:
result = sqldb.count_scrobbles_by_album(since=since,to=to,resolve_ids=resolve_ids,dbconn=dbconn)
return result

View File

@ -29,6 +29,8 @@ def uri_to_internal(keys,accepted_entities=('artist','track','album'),forceTrack
# 1
filterkeys = {}
# this only takes care of the logic - what kind of entity we're dealing with
# it does not check with the database if it exists or what the canonical name is!!!
if "track" in accepted_entities and "title" in keys:
filterkeys.update({"track":{"artists":keys.getall("trackartist"),"title":keys.get("title")}})
if "artist" in accepted_entities and "artist" in keys:

View File

@ -29,7 +29,7 @@
{% for entry in dbc.get_charts_albums(filterkeys,limitkeys,{'only_own_albums':False}) %}
{% if artist not in (entry.album.artists or []) %}
{% if info.artist not in (entry.album.artists or []) %}
{%- set cert = None -%}
{%- if entry.scrobbles >= settings.scrobbles_gold_album -%}{% set cert = 'gold' %}{%- endif -%}