mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Slightly reworked maintenance
This commit is contained in:
parent
5a548f1979
commit
79544044be
@ -22,23 +22,20 @@ def update_medals():
|
|||||||
|
|
||||||
|
|
||||||
MEDALS.clear()
|
MEDALS.clear()
|
||||||
|
MEDALS_TRACKS.clear()
|
||||||
|
|
||||||
for year in range(firstyear,currentyear):
|
for year in range(firstyear,currentyear):
|
||||||
|
charts_artists = get_charts_artists(within=[year])
|
||||||
|
charts_tracks = get_charts_tracks(within=[year])
|
||||||
|
|
||||||
charts = get_charts_artists(within=[year])
|
for a in charts_artists:
|
||||||
for a in charts:
|
|
||||||
|
|
||||||
artist = a["artist"]
|
artist = a["artist"]
|
||||||
if a["rank"] == 1: MEDALS.setdefault(artist,{}).setdefault("gold",[]).append(year)
|
if a["rank"] == 1: MEDALS.setdefault(artist,{}).setdefault("gold",[]).append(year)
|
||||||
elif a["rank"] == 2: MEDALS.setdefault(artist,{}).setdefault("silver",[]).append(year)
|
elif a["rank"] == 2: MEDALS.setdefault(artist,{}).setdefault("silver",[]).append(year)
|
||||||
elif a["rank"] == 3: MEDALS.setdefault(artist,{}).setdefault("bronze",[]).append(year)
|
elif a["rank"] == 3: MEDALS.setdefault(artist,{}).setdefault("bronze",[]).append(year)
|
||||||
else: break
|
else: break
|
||||||
|
|
||||||
MEDALS_TRACKS.clear()
|
for t in charts_tracks:
|
||||||
for year in range(firstyear,currentyear):
|
|
||||||
|
|
||||||
charts = get_charts_tracks(within=[year])
|
|
||||||
for t in charts:
|
|
||||||
|
|
||||||
track = (frozenset(t["track"]["artists"]),t["track"]["title"])
|
track = (frozenset(t["track"]["artists"]),t["track"]["title"])
|
||||||
if t["rank"] == 1: MEDALS_TRACKS.setdefault(track,{}).setdefault("gold",[]).append(year)
|
if t["rank"] == 1: MEDALS_TRACKS.setdefault(track,{}).setdefault("gold",[]).append(year)
|
||||||
elif t["rank"] == 2: MEDALS_TRACKS.setdefault(track,{}).setdefault("silver",[]).append(year)
|
elif t["rank"] == 2: MEDALS_TRACKS.setdefault(track,{}).setdefault("silver",[]).append(year)
|
||||||
@ -60,10 +57,12 @@ def update_weekly():
|
|||||||
for a in get_charts_artists(timerange=week):
|
for a in get_charts_artists(timerange=week):
|
||||||
artist = a["artist"]
|
artist = a["artist"]
|
||||||
if a["rank"] == 1: WEEKLY_TOPARTISTS[artist] = WEEKLY_TOPARTISTS.setdefault(artist,0) + 1
|
if a["rank"] == 1: WEEKLY_TOPARTISTS[artist] = WEEKLY_TOPARTISTS.setdefault(artist,0) + 1
|
||||||
|
else: break
|
||||||
|
|
||||||
for t in get_charts_tracks(timerange=week):
|
for t in get_charts_tracks(timerange=week):
|
||||||
track = (frozenset(t["track"]["artists"]),t["track"]["title"])
|
track = (frozenset(t["track"]["artists"]),t["track"]["title"])
|
||||||
if t["rank"] == 1: WEEKLY_TOPTRACKS[track] = WEEKLY_TOPTRACKS.setdefault(track,0) + 1
|
if t["rank"] == 1: WEEKLY_TOPTRACKS[track] = WEEKLY_TOPTRACKS.setdefault(track,0) + 1
|
||||||
|
else: break
|
||||||
|
|
||||||
|
|
||||||
@daily
|
@daily
|
||||||
|
Loading…
Reference in New Issue
Block a user