mirror of
https://github.com/krateng/maloja.git
synced 2025-06-05 09:53:30 +03:00
Artists can now be pseudo-certified via their tracks or albums
This commit is contained in:
parent
964128fdff
commit
0e311e0ac8
@ -597,6 +597,24 @@ def artist_info(dbconn=None,**keys):
|
|||||||
albums = sqldb.get_albums_of_artists(set([artist_id]),dbconn=dbconn)
|
albums = sqldb.get_albums_of_artists(set([artist_id]),dbconn=dbconn)
|
||||||
isalbumartist = len(albums.get(artist_id,[]))>0
|
isalbumartist = len(albums.get(artist_id,[]))>0
|
||||||
|
|
||||||
|
cert = None
|
||||||
|
own_track_charts = get_charts_tracks(timerange=alltime(),resolve_ids=False,artist=artist,dbconn=dbconn)
|
||||||
|
own_album_charts = get_charts_albums(timerange=alltime(),resolve_ids=False,artist=artist,dbconn=dbconn)
|
||||||
|
if own_track_charts:
|
||||||
|
c = own_track_charts[0]
|
||||||
|
scrobbles = c["scrobbles"]
|
||||||
|
threshold_gold, threshold_platinum, threshold_diamond = malojaconfig["SCROBBLES_GOLD","SCROBBLES_PLATINUM","SCROBBLES_DIAMOND"]
|
||||||
|
if scrobbles >= threshold_diamond: cert = "diamond"
|
||||||
|
elif scrobbles >= threshold_platinum: cert = "platinum"
|
||||||
|
elif scrobbles >= threshold_gold: cert = "gold"
|
||||||
|
if own_album_charts:
|
||||||
|
c = own_album_charts[0]
|
||||||
|
scrobbles = c["scrobbles"]
|
||||||
|
threshold_gold, threshold_platinum, threshold_diamond = malojaconfig["SCROBBLES_GOLD_ALBUM","SCROBBLES_PLATINUM_ALBUM","SCROBBLES_DIAMOND_ALBUM"]
|
||||||
|
if scrobbles >= threshold_diamond: cert = "diamond"
|
||||||
|
elif scrobbles >= threshold_platinum and cert != "diamond": cert = "platinum"
|
||||||
|
elif scrobbles >= threshold_gold and not cert: cert = "gold"
|
||||||
|
|
||||||
twk = thisweek()
|
twk = thisweek()
|
||||||
tyr = thisyear()
|
tyr = thisyear()
|
||||||
|
|
||||||
@ -631,6 +649,7 @@ def artist_info(dbconn=None,**keys):
|
|||||||
sqldb.count_scrobbles_by_artist(since=year.first_stamp(),to=year.last_stamp(),resolve_ids=False,dbconn=dbconn)
|
sqldb.count_scrobbles_by_artist(since=year.first_stamp(),to=year.last_stamp(),resolve_ids=False,dbconn=dbconn)
|
||||||
)]
|
)]
|
||||||
},
|
},
|
||||||
|
"certification":cert,
|
||||||
"topweeks":len([
|
"topweeks":len([
|
||||||
week for week in ranges(step="week") if (week != twk) and any(
|
week for week in ranges(step="week") if (week != twk) and any(
|
||||||
(e.get('artist_id') == artist_id) and (e.get('rank') == 1) for e in
|
(e.get('artist_id') == artist_id) and (e.get('rank') == 1) for e in
|
||||||
|
@ -26,6 +26,10 @@
|
|||||||
|
|
||||||
{% set encodedartist = mlj_uri.uriencode({'artist':artist}) %}
|
{% set encodedartist = mlj_uri.uriencode({'artist':artist}) %}
|
||||||
|
|
||||||
|
{% block custombodyclasses %}
|
||||||
|
{% if info.certification %}certified certified_{{ info.certification }}{% endif %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
{% block icon_bar %}
|
{% block icon_bar %}
|
||||||
{% if adminmode %}
|
{% if adminmode %}
|
||||||
{% include 'icons/edit.jinja' %}
|
{% include 'icons/edit.jinja' %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user