mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Fixed things for albumartists with no tracks
This commit is contained in:
parent
e18dffbd2f
commit
5eec25963b
@ -400,13 +400,21 @@ def artist_info(dbconn=None,**keys):
|
|||||||
alltimecharts = get_charts_artists(timerange=alltime(),dbconn=dbconn)
|
alltimecharts = get_charts_artists(timerange=alltime(),dbconn=dbconn)
|
||||||
scrobbles = get_scrobbles_num(artist=artist,timerange=alltime(),dbconn=dbconn)
|
scrobbles = get_scrobbles_num(artist=artist,timerange=alltime(),dbconn=dbconn)
|
||||||
#we cant take the scrobble number from the charts because that includes all countas scrobbles
|
#we cant take the scrobble number from the charts because that includes all countas scrobbles
|
||||||
try:
|
|
||||||
c = [e for e in alltimecharts if e["artist"] == artist][0]
|
# base info for everyone
|
||||||
|
result = {
|
||||||
|
"artist":artist,
|
||||||
|
"scrobbles":scrobbles,
|
||||||
|
"id":artist_id
|
||||||
|
}
|
||||||
|
|
||||||
|
# check if credited to someone else
|
||||||
|
parent_artists = sqldb.get_credited_artists(artist)
|
||||||
|
if len(parent_artists) == 0:
|
||||||
|
c = [e for e in alltimecharts if e["artist"] == artist]
|
||||||
|
position = c[0]["rank"] if len(c) > 0 else None
|
||||||
others = sqldb.get_associated_artists(artist,dbconn=dbconn)
|
others = sqldb.get_associated_artists(artist,dbconn=dbconn)
|
||||||
position = c["rank"]
|
result.update({
|
||||||
return {
|
|
||||||
"artist":artist,
|
|
||||||
"scrobbles":scrobbles,
|
|
||||||
"position":position,
|
"position":position,
|
||||||
"associated":others,
|
"associated":others,
|
||||||
"medals":{
|
"medals":{
|
||||||
@ -414,23 +422,19 @@ def artist_info(dbconn=None,**keys):
|
|||||||
"silver": [year for year in cached.medals_artists if artist_id in cached.medals_artists[year]['silver']],
|
"silver": [year for year in cached.medals_artists if artist_id in cached.medals_artists[year]['silver']],
|
||||||
"bronze": [year for year in cached.medals_artists if artist_id in cached.medals_artists[year]['bronze']],
|
"bronze": [year for year in cached.medals_artists if artist_id in cached.medals_artists[year]['bronze']],
|
||||||
},
|
},
|
||||||
"topweeks":len([e for e in cached.weekly_topartists if e == artist_id]),
|
"topweeks":len([e for e in cached.weekly_topartists if e == artist_id])
|
||||||
"id":artist_id
|
})
|
||||||
}
|
|
||||||
except Exception:
|
else:
|
||||||
# if the artist isnt in the charts, they are not being credited and we
|
replaceartist = parent_artists[0]
|
||||||
# need to show information about the credited one
|
|
||||||
replaceartist = sqldb.get_credited_artists(artist)[0]
|
|
||||||
c = [e for e in alltimecharts if e["artist"] == replaceartist][0]
|
c = [e for e in alltimecharts if e["artist"] == replaceartist][0]
|
||||||
position = c["rank"]
|
position = c["rank"]
|
||||||
return {
|
result.update({
|
||||||
"artist":artist,
|
|
||||||
"replace":replaceartist,
|
"replace":replaceartist,
|
||||||
"scrobbles":scrobbles,
|
"position":position
|
||||||
"position":position,
|
})
|
||||||
"id":artist_id
|
|
||||||
}
|
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@
|
|||||||
</td>
|
</td>
|
||||||
<td class="text">
|
<td class="text">
|
||||||
<h1 id="main_entity_name" class="headerwithextra">{{ info.artist | e }}</h1>
|
<h1 id="main_entity_name" class="headerwithextra">{{ info.artist | e }}</h1>
|
||||||
{% if competes %}<span class="rank"><a href="/charts_artists?max=100">#{{ info.position }}</a></span>{% endif %}
|
{% if competes and info['scrobbles']>0 %}<span class="rank"><a href="/charts_artists?max=100">#{{ info.position }}</a></span>{% endif %}
|
||||||
<br/>
|
<br/>
|
||||||
{% if competes and included %}
|
{% if competes and included %}
|
||||||
<span>associated: {{ links.links(included) }}</span>
|
<span>associated: {{ links.links(included) }}</span>
|
||||||
|
Loading…
Reference in New Issue
Block a user