diff --git a/database.py b/database.py index 3daa304..afbc1e1 100644 --- a/database.py +++ b/database.py @@ -535,7 +535,14 @@ def artistInfo(artist): c = [e for e in charts if e["artist"] == artist][0] others = [a for a in coa.getAllAssociated(artist) if a in ARTISTS] position = c["rank"] - return {"scrobbles":scrobbles,"position":position,"associated":others,"medals":MEDALS.get(artist)} + performance = get_performance(artist=artist,step="week") + return { + "scrobbles":scrobbles, + "position":position, + "associated":others, + "medals":MEDALS.get(artist), + "topweeks":len([p for p in performance if p["rank"] == 1]) + } except: # if the artist isnt in the charts, they are not being credited and we # need to show information about the credited one @@ -567,6 +574,7 @@ def trackInfo(track): c = [e for e in charts if e["track"] == track][0] scrobbles = c["scrobbles"] position = c["rank"] + performance = get_performance(track=track,step="week") cert = None threshold_gold, threshold_platinum, threshold_diamond = settings.get_settings("SCROBBLES_GOLD","SCROBBLES_PLATINUM","SCROBBLES_DIAMOND") if scrobbles >= threshold_diamond: cert = "diamond" @@ -577,7 +585,8 @@ def trackInfo(track): "scrobbles":scrobbles, "position":position, "medals":MEDALS_TRACKS.get((frozenset(track["artists"]),track["title"])), - "certification":cert + "certification":cert, + "topweeks":len([p for p in performance if p["rank"] == 1]) } diff --git a/website/artist.html b/website/artist.html index 135281e..d9f4a03 100644 --- a/website/artist.html +++ b/website/artist.html @@ -22,7 +22,7 @@
KEY_DESCRIPTION
- KEY_MEDALS KEY_CERTS + KEY_MEDALS KEY_TOPWEEKS KEY_CERTS diff --git a/website/artist.py b/website/artist.py index dc93883..bf3f2fa 100644 --- a/website/artist.py +++ b/website/artist.py @@ -41,6 +41,13 @@ def instructions(keys): html_cert += "".format(tooltip=tooltip,img=img,link=tracklink) + html_topweeks = "" + if data.get("topweeks") not in [0,None]: + link = "/performance?artist=" + urllib.parse.quote(keys["artist"]) + "&trail=1&step=week" + title = str(data["topweeks"]) + " weeks on #1" + html_topweeks = "" + str(data["topweeks"]) + "" + + credited = data.get("replace") includestr = " " if credited is not None: @@ -81,6 +88,7 @@ def instructions(keys): "KEY_ASSOCIATED":includestr, "KEY_MEDALS":html_medals, "KEY_CERTS":html_cert, + "KEY_TOPWEEKS":html_topweeks, # tracks "KEY_TRACKLIST":html_tracks, # pulse diff --git a/website/css/maloja.css b/website/css/maloja.css index 8cc92a1..ca50cec 100644 --- a/website/css/maloja.css +++ b/website/css/maloja.css @@ -389,6 +389,11 @@ img.certrecord_small { vertical-align: text-bottom; } +img.star { + height:20px; + vertical-align: text-bottom; +} + /* ** diff --git a/website/media/star.png b/website/media/star.png new file mode 100644 index 0000000..23dfd6b Binary files /dev/null and b/website/media/star.png differ diff --git a/website/media/star_alt.png b/website/media/star_alt.png new file mode 100644 index 0000000..007d9a2 Binary files /dev/null and b/website/media/star_alt.png differ diff --git a/website/track.html b/website/track.html index bc99a11..c67b824 100644 --- a/website/track.html +++ b/website/track.html @@ -21,7 +21,7 @@ - KEY_MEDALS + KEY_MEDALS KEY_TOPWEEKS diff --git a/website/track.py b/website/track.py index 9fa0406..8f108e7 100644 --- a/website/track.py +++ b/website/track.py @@ -37,6 +37,12 @@ def instructions(keys): for y in data["medals"]["bronze"]: html_medals += "" + str(y) + "" + html_topweeks = "" + if data.get("topweeks") not in [0,None]: + link = "/performance?" + compose_querystring(keys) + "&trail=1&step=week" + title = str(data["topweeks"]) + " weeks on #1" + html_topweeks = "" + str(data["topweeks"]) + "" + html_scrobbles, _, _ = module_scrobblelist(track=track,max_=10,earlystop=True) # we have the number already from the trackinfo @@ -65,6 +71,7 @@ def instructions(keys): "KEY_SCROBBLELINK":compose_querystring(keys), "KEY_MEDALS":html_medals, "KEY_CERTS":html_cert, + "KEY_TOPWEEKS":html_topweeks, "KEY_SCROBBLELIST":html_scrobbles, # pulse "KEY_PULSE_MONTHS":html_pulse_months,