mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
More concise medal code
This commit is contained in:
parent
f540862881
commit
e1eacbb272
@ -572,7 +572,7 @@ def artistInfo(artist):
|
|||||||
"scrobbles":scrobbles,
|
"scrobbles":scrobbles,
|
||||||
"position":position,
|
"position":position,
|
||||||
"associated":others,
|
"associated":others,
|
||||||
"medals":MEDALS.get(artist),
|
"medals":{"gold":[],"silver":[],"bronze":[],**MEDALS.get(artist,{})},
|
||||||
"topweeks":WEEKLY_TOPARTISTS.get(artist,0)
|
"topweeks":WEEKLY_TOPARTISTS.get(artist,0)
|
||||||
}
|
}
|
||||||
except:
|
except:
|
||||||
@ -616,7 +616,7 @@ def trackInfo(track):
|
|||||||
return {
|
return {
|
||||||
"scrobbles":scrobbles,
|
"scrobbles":scrobbles,
|
||||||
"position":position,
|
"position":position,
|
||||||
"medals":MEDALS_TRACKS.get((frozenset(track["artists"]),track["title"])),
|
"medals":{"gold":[],"silver":[],"bronze":[],**MEDALS_TRACKS.get((frozenset(track["artists"]),track["title"]),{})},
|
||||||
"certification":cert,
|
"certification":cert,
|
||||||
"topweeks":WEEKLY_TOPTRACKS.get(((frozenset(track["artists"]),track["title"])),0)
|
"topweeks":WEEKLY_TOPTRACKS.get(((frozenset(track["artists"]),track["title"])),0)
|
||||||
}
|
}
|
||||||
|
@ -57,22 +57,17 @@
|
|||||||
<span><pyhp echo="includestring" /></span>
|
<span><pyhp echo="includestring" /></span>
|
||||||
<p class="stats"><a href="/scrobbles?{encodedartist}"><pyhp echo="info['scrobbles']" /> Scrobbles</a></p>
|
<p class="stats"><a href="/scrobbles?{encodedartist}"><pyhp echo="info['scrobbles']" /> Scrobbles</a></p>
|
||||||
|
|
||||||
<pyhp if="info.get('medals') is not None and 'gold' in info['medals']">
|
<pyhp for="year" in="info['medals']['gold']">
|
||||||
<pyhp for="y" in="info['medals']['gold']">
|
<a title="Best Artist in {year}" class="hidelink medal shiny gold" href='/charts_artists?max=50&in=" + str(year) + "'><span><pyhp echo="year" /></span></a>
|
||||||
<a title="Best Artist in {y}" class="hidelink medal shiny gold" href='/charts_artists?max=50&in=" + str(y) + "'><span><pyhp echo="y" /></span></a>
|
|
||||||
</pyhp>
|
|
||||||
</pyhp>
|
</pyhp>
|
||||||
<pyhp if="info.get('medals') is not None and 'silver' in info['medals']">
|
<pyhp for="year" in="info['medals']['silver']">
|
||||||
<pyhp for="y" in="info['medals']['silver']">
|
<a title="Second best Artist in {year}" class="hidelink medal shiny silver" href='/charts_artists?max=50&in=" + str(year) + "'><span><pyhp echo="year" /></span></a>
|
||||||
<a title="Second Best Artist in {y}" class="hidelink medal shiny silver" href='/charts_artists?max=50&in=" + str(y) + "'><span><pyhp echo="y" /></span></a>
|
|
||||||
</pyhp>
|
|
||||||
</pyhp>
|
</pyhp>
|
||||||
<pyhp if="info.get('medals') is not None and 'bronze' in info['medals']">
|
<pyhp for="year" in="info['medals']['bronze']">
|
||||||
<pyhp for="y" in="info['medals']['bronze']">
|
<a title="Third best Artist in {year}" class="hidelink medal shiny bronze" href='/charts_artists?max=50&in=" + str(year) + "'><span><pyhp echo="year" /></span></a>
|
||||||
<a title="Third Best Artist in {y}" class="hidelink medal shiny bronze" href='/charts_artists?max=50&in=" + str(y) + "'><span><pyhp echo="y" /></span></a>
|
|
||||||
</pyhp>
|
|
||||||
</pyhp>
|
</pyhp>
|
||||||
|
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
@ -85,10 +80,10 @@
|
|||||||
<table class="twopart">
|
<table class="twopart">
|
||||||
|
|
||||||
<pyhp save="[
|
<pyhp save="[
|
||||||
('days','7 days',malojatime.today().next(-6),'day',7),
|
('day','7 days',malojatime.today().next(-6),'day',7),
|
||||||
('weeks','12 weeks',malojatime.thisweek().next(-11),'week',12),
|
('week','12 weeks',malojatime.thisweek().next(-11),'week',12),
|
||||||
('months','12 months',malojatime.thismonth().next(-11),'month',12),
|
('month','12 months',malojatime.thismonth().next(-11),'month',12),
|
||||||
('years','10 years',malojatime.thisyear().next(-9),'year',12)
|
('year','10 years',malojatime.thisyear().next(-9),'year',12)
|
||||||
]" as="ranges" />
|
]" as="ranges" />
|
||||||
|
|
||||||
|
|
||||||
@ -100,10 +95,10 @@
|
|||||||
|
|
||||||
<pyhp for="range" in="ranges" separator = " | ">
|
<pyhp for="range" in="ranges" separator = " | ">
|
||||||
<pyhp if="initialrange==range[0]">
|
<pyhp if="initialrange==range[0]">
|
||||||
<span onclick="showRange('pulse','{range[0]}')" class="stat_selector_pulse selector_pulse_{range[0]}" style="opacity:0.5;"><pyhp echo="range[1]" /></span>
|
<span onclick="showRangeManual('pulse','{range[0]}')" class="stat_selector_pulse selector_pulse_{range[0]}" style="opacity:0.5;"><pyhp echo="range[1]" /></span>
|
||||||
</pyhp>
|
</pyhp>
|
||||||
<pyhp if="initialrange!=range[0]">
|
<pyhp if="initialrange!=range[0]">
|
||||||
<span onclick="showRange('pulse','{range[0]}')" class="stat_selector_pulse selector_pulse_{range[0]}"><pyhp echo="range[1]" /></span>
|
<span onclick="showRangeManual('pulse','{range[0]}')" class="stat_selector_pulse selector_pulse_{range[0]}"><pyhp echo="range[1]" /></span>
|
||||||
</pyhp>
|
</pyhp>
|
||||||
</pyhp>
|
</pyhp>
|
||||||
|
|
||||||
@ -126,10 +121,10 @@
|
|||||||
|
|
||||||
<pyhp for="range" in="ranges" separator = " | ">
|
<pyhp for="range" in="ranges" separator = " | ">
|
||||||
<pyhp if="initialrange==range[0]">
|
<pyhp if="initialrange==range[0]">
|
||||||
<span onclick="showRange('pulse','{range[0]}')" class="stat_selector_pulse selector_pulse_{range[0]}" style="opacity:0.5;"><pyhp echo="range[1]" /></span>
|
<span onclick="showRangeManual('pulse','{range[0]}')" class="stat_selector_pulse selector_pulse_{range[0]}" style="opacity:0.5;"><pyhp echo="range[1]" /></span>
|
||||||
</pyhp>
|
</pyhp>
|
||||||
<pyhp if="initialrange!=range[0]">
|
<pyhp if="initialrange!=range[0]">
|
||||||
<span onclick="showRange('pulse','{range[0]}')" class="stat_selector_pulse selector_pulse_{range[0]}"><pyhp echo="range[1]" /></span>
|
<span onclick="showRangeManual('pulse','{range[0]}')" class="stat_selector_pulse selector_pulse_{range[0]}"><pyhp echo="range[1]" /></span>
|
||||||
</pyhp>
|
</pyhp>
|
||||||
|
|
||||||
</pyhp>
|
</pyhp>
|
||||||
|
@ -33,20 +33,14 @@
|
|||||||
|
|
||||||
<p class="stats"><a href="/scrobbles?{encodedtrack}"><pyhp echo="info['scrobbles']" /> Scrobbles</a></p>
|
<p class="stats"><a href="/scrobbles?{encodedtrack}"><pyhp echo="info['scrobbles']" /> Scrobbles</a></p>
|
||||||
|
|
||||||
<pyhp if="info.get('medals') is not None and 'gold' in info['medals']">
|
<pyhp for="year" in="info['medals']['gold']">
|
||||||
<pyhp for="y" in="info['medals']['gold']">
|
<a title="Best Artist in {year}" class="hidelink medal shiny gold" href='/charts_artists?max=50&in=" + str(year) + "'><span><pyhp echo="year" /></span></a>
|
||||||
<a title="Best Track in {y}" class="hidelink medal shiny gold" href='/charts_artists?max=50&in=" + str(y) + "'><span><pyhp echo="y" /></span></a>
|
|
||||||
</pyhp>
|
|
||||||
</pyhp>
|
</pyhp>
|
||||||
<pyhp if="info.get('medals') is not None and 'silver' in info['medals']">
|
<pyhp for="year" in="info['medals']['silver']">
|
||||||
<pyhp for="y" in="info['medals']['silver']">
|
<a title="Second best Artist in {year}" class="hidelink medal shiny silver" href='/charts_artists?max=50&in=" + str(year) + "'><span><pyhp echo="year" /></span></a>
|
||||||
<a title="Second Best Track in {y}" class="hidelink medal shiny silver" href='/charts_artists?max=50&in=" + str(y) + "'><span><pyhp echo="y" /></span></a>
|
|
||||||
</pyhp>
|
|
||||||
</pyhp>
|
</pyhp>
|
||||||
<pyhp if="info.get('medals') is not None and 'bronze' in info['medals']">
|
<pyhp for="year" in="info['medals']['bronze']">
|
||||||
<pyhp for="y" in="info['medals']['bronze']">
|
<a title="Third best Artist in {year}" class="hidelink medal shiny bronze" href='/charts_artists?max=50&in=" + str(year) + "'><span><pyhp echo="year" /></span></a>
|
||||||
<a title="Third Best Track in {y}" class="hidelink medal shiny bronze" href='/charts_artists?max=50&in=" + str(y) + "'><span><pyhp echo="y" /></span></a>
|
|
||||||
</pyhp>
|
|
||||||
</pyhp>
|
</pyhp>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -56,10 +50,10 @@
|
|||||||
<table class="twopart">
|
<table class="twopart">
|
||||||
|
|
||||||
<pyhp save="[
|
<pyhp save="[
|
||||||
('days','7 days',malojatime.today().next(-6),'day',7),
|
('day','7 days',malojatime.today().next(-6),'day',7),
|
||||||
('weeks','12 weeks',malojatime.thisweek().next(-11),'week',12),
|
('week','12 weeks',malojatime.thisweek().next(-11),'week',12),
|
||||||
('months','12 months',malojatime.thismonth().next(-11),'month',12),
|
('month','12 months',malojatime.thismonth().next(-11),'month',12),
|
||||||
('years','10 years',malojatime.thisyear().next(-9),'year',12)
|
('year','10 years',malojatime.thisyear().next(-9),'year',12)
|
||||||
]" as="ranges" />
|
]" as="ranges" />
|
||||||
|
|
||||||
|
|
||||||
@ -71,10 +65,10 @@
|
|||||||
|
|
||||||
<pyhp for="range" in="ranges" separator = " | ">
|
<pyhp for="range" in="ranges" separator = " | ">
|
||||||
<pyhp if="initialrange==range[0]">
|
<pyhp if="initialrange==range[0]">
|
||||||
<span onclick="showRange('pulse','{range[0]}')" class="stat_selector_pulse selector_pulse_{range[0]}" style="opacity:0.5;"><pyhp echo="range[1]" /></span>
|
<span onclick="showRangeManual('pulse','{range[0]}')" class="stat_selector_pulse selector_pulse_{range[0]}" style="opacity:0.5;"><pyhp echo="range[1]" /></span>
|
||||||
</pyhp>
|
</pyhp>
|
||||||
<pyhp if="initialrange!=range[0]">
|
<pyhp if="initialrange!=range[0]">
|
||||||
<span onclick="showRange('pulse','{range[0]}')" class="stat_selector_pulse selector_pulse_{range[0]}"><pyhp echo="range[1]" /></span>
|
<span onclick="showRangeManual('pulse','{range[0]}')" class="stat_selector_pulse selector_pulse_{range[0]}"><pyhp echo="range[1]" /></span>
|
||||||
</pyhp>
|
</pyhp>
|
||||||
</pyhp>
|
</pyhp>
|
||||||
|
|
||||||
@ -97,10 +91,10 @@
|
|||||||
|
|
||||||
<pyhp for="range" in="ranges" separator = " | ">
|
<pyhp for="range" in="ranges" separator = " | ">
|
||||||
<pyhp if="initialrange==range[0]">
|
<pyhp if="initialrange==range[0]">
|
||||||
<span onclick="showRange('pulse','{range[0]}')" class="stat_selector_pulse selector_pulse_{range[0]}" style="opacity:0.5;"><pyhp echo="range[1]" /></span>
|
<span onclick="showRangeManual('pulse','{range[0]}')" class="stat_selector_pulse selector_pulse_{range[0]}" style="opacity:0.5;"><pyhp echo="range[1]" /></span>
|
||||||
</pyhp>
|
</pyhp>
|
||||||
<pyhp if="initialrange!=range[0]">
|
<pyhp if="initialrange!=range[0]">
|
||||||
<span onclick="showRange('pulse','{range[0]}')" class="stat_selector_pulse selector_pulse_{range[0]}"><pyhp echo="range[1]" /></span>
|
<span onclick="showRangeManual('pulse','{range[0]}')" class="stat_selector_pulse selector_pulse_{range[0]}"><pyhp echo="range[1]" /></span>
|
||||||
</pyhp>
|
</pyhp>
|
||||||
|
|
||||||
</pyhp>
|
</pyhp>
|
||||||
|
Loading…
Reference in New Issue
Block a user