1
0
mirror of https://github.com/krateng/maloja.git synced 2023-08-10 21:12:55 +03:00

Added first partial pyhp modules

This commit is contained in:
Krateng 2019-12-13 21:04:12 +01:00
parent c95ce17451
commit 6369cbbeb8
5 changed files with 75 additions and 14 deletions

View File

@ -7,14 +7,14 @@ author = {
"email":"maloja@krateng.dev",
"github": "krateng"
}
version = 2,1,4
version = 2,2,0
versionstr = ".".join(str(n) for n in version)
requires = [
"bottle>=0.12.16",
"waitress>=1.3",
"doreah>=1.2.10",
"doreah>=1.4",
"nimrodel>=0.6.3",
"setproctitle>=1.1.10",
"wand>=0.5.4",

View File

@ -110,6 +110,10 @@
<a class="textlink" href="/manual">Manual Scrobbling</a><br/>
<a class="textlink" href="/issues">Database Maintenance</a>
<h2>External</h2>
<a class="textlink" href="https://github.com/krateng/maloja/issues/new">Report Issue</a><br/>
<pyhp include="common/footer.html" />
</body>
</html>

View File

@ -114,13 +114,13 @@
<br/><br/>
<pyhp for="range" in="ranges">
<pyhp if="initialrange==range[0]">
<span class="stat_module_pulse pulse_{range[0]}"><pyhp echo="htmlmodules.module_pulse(artist=artist,max_=range[4],since=range[2],step=range[3],trail=1)" /></span>
</pyhp>
<pyhp if="initialrange!=range[0]">
<span class="stat_module_pulse pulse_{range[0]}" style="display:none;"><pyhp echo="htmlmodules.module_pulse(artist=artist,max_=range[4],since=range[2],step=range[3],trail=1)" /></span>
</pyhp>
<span class="stat_module_pulse pulse_{range[0]}" style="{'display:none;' if initialrange==range[0] else ''}">
<!--<pyhp echo="htmlmodules.module_pulse(artist=artist,max_=range[4],since=range[2],step=range[3],trail=1)" />-->
<pyhp with="{'amountkeys':{'max_':range[4]},'limitkeys':{'since':range[2]},'delimitkeys':{'step':range[3],'trail':1}}">
<pyhp include="partial/pulse.pyhp" />
</pyhp>
</span>
</pyhp>
</td>
@ -141,12 +141,13 @@
<br/><br/>
<pyhp for="range" in="ranges">
<pyhp if="initialrange==range[0]">
<span class="stat_module_pulse pulse_{range[0]}"><pyhp echo="htmlmodules.module_performance(artist=credited,max_=range[4],since=range[2],step=range[3],trail=1)" /></span>
</pyhp>
<pyhp if="initialrange!=range[0]">
<span class="stat_module_pulse pulse_{range[0]}" style="display:none;"><pyhp echo="htmlmodules.module_performance(artist=credited,max_=range[4],since=range[2],step=range[3],trail=1)" /></span>
</pyhp>
<span class="stat_module_pulse pulse_{range[0]}" style="{'display:none;' if initialrange==range[0] else ''}">
<!--<pyhp echo="htmlmodules.module_performance(artist=credited,max_=range[4],since=range[2],step=range[3],trail=1)" />-->
<pyhp with="{'filterkeys':{'artist':credited},'amountkeys':{'max_':range[4]},'limitkeys':{'since':range[2]},'delimitkeys':{'step':range[3],'trail':1}}">
<pyhp include="partial/performance.pyhp" />
</pyhp>
</span>
</pyhp>
</td>

View File

@ -0,0 +1,31 @@
<pyhp>
if amountkeys["max_"] is not None: amountkeys["perpage"],amountkeys["page"] = amountkeys["max_"],0
firstindex = amountkeys["page"] * amountkeys["perpage"]
lastindex = firstindex + amountkeys["perpage"]
</pyhp>
<pyhp import="math" />
<pyhp save="db.get_performance(**limitkeys,**delimitkeys,**filterkeys)" as="allranges" />
<pyhp save="math.ceil(len(allranges) / amountkeys['perpage'])" as="pages" />
<pyhp save="allranges[firstindex:lastindex]" as="displayranges" />
<pyhp>
minrank = 80
for t in displayranges:
if t["rank"] is not None and t["rank"]+20 > minrank: minrank = t["rank"]+20
</pyhp>
</pyhp>
<table class="list">
<pyhp for="t" in="displayranges">
<pyhp save="t['range']" as="thisrange" />
<tr>
<td><pyhp echo="thisrange.desc()" /></td>
<td class='rank'><pyhp echo="'#' + str(t['rank']) if t['rank'] is not None else 'n/a'" /></td>
<pyhp save="(minrank+1-t['rank'])*100/minrank if t['rank'] is not None else 0" as="prct" />
<td class='chart'><pyhp echo="htmlgenerators.rankLink(thisrange.urikeys(),percent=prct,**filterkeys,medal=t['rank'])" /></td>
</tr>
</pyhp>
</table>

View File

@ -0,0 +1,25 @@
<pyhp>
if amountkeys["max_"] is not None: amountkeys["perpage"],amountkeys["page"] = amountkeys["max_"],0
firstindex = amountkeys["page"] * amountkeys["perpage"]
lastindex = firstindex + amountkeys["perpage"]
</pyhp>
<pyhp import="math" />
<pyhp save="db.get_pulse(**limitkeys,**delimitkeys,**filterkeys)" as="allranges" />
<pyhp save="math.ceil(len(allranges) / amountkeys['perpage'])" as="pages" />
<pyhp save="allranges[firstindex:lastindex]" as="displayranges" />
<pyhp save="max(max([t['scrobbles'] for t in displayranges]),1)" as="maxbar" />
<table class="list">
<pyhp for="t" in="displayranges">
<pyhp save="t['range']" as="thisrange" />
<tr>
<td><pyhp echo="thisrange.desc()" /></td>
<td class="amount"><pyhp echo="htmlgenerators.scrobblesLink(thisrange.urikeys(),amount=t['scrobbles'],**filterkeys)" /></td>
<td class="bar"><pyhp echo="htmlgenerators.scrobblesLink(thisrange.urikeys(),percent=t['scrobbles']*100/maxbar,**filterkeys)" /></td>
</tr>
</pyhp>
</table>