mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Switched track page to pyhp
This commit is contained in:
parent
7b3c72d211
commit
15970ff2c6
@ -13,6 +13,7 @@ import htmlgenerators
|
|||||||
import malojatime
|
import malojatime
|
||||||
from utilities import *
|
from utilities import *
|
||||||
from urihandler import uri_to_internal, remove_identical
|
from urihandler import uri_to_internal, remove_identical
|
||||||
|
import urihandler
|
||||||
# doreah toolkit
|
# doreah toolkit
|
||||||
from doreah import settings
|
from doreah import settings
|
||||||
from doreah.logging import log
|
from doreah.logging import log
|
||||||
@ -151,6 +152,7 @@ def static_html(name):
|
|||||||
environ["htmlgenerators"] = htmlgenerators
|
environ["htmlgenerators"] = htmlgenerators
|
||||||
environ["malojatime"] = malojatime
|
environ["malojatime"] = malojatime
|
||||||
environ["utilities"] = utilities
|
environ["utilities"] = utilities
|
||||||
|
environ["urihandler"] = urihandler
|
||||||
# external
|
# external
|
||||||
environ["urllib"] = urllib
|
environ["urllib"] = urllib
|
||||||
# request
|
# request
|
||||||
|
@ -26,8 +26,9 @@
|
|||||||
<pyhp save="'associated: ' + htmlgenerators.artistLinks(included)" as="includestring" />
|
<pyhp save="'associated: ' + htmlgenerators.artistLinks(included)" as="includestring" />
|
||||||
</pyhp>
|
</pyhp>
|
||||||
|
|
||||||
<pyhp save="urllib.parse.quote(artist)" as="encodedartist" />
|
<!-- url encode -->
|
||||||
<pyhp save="urllib.parse.quote(credited)" as="encodedcredited" />
|
<pyhp save="urihandler.compose_querystring(urihandler.internal_to_uri({'artist':artist}))" as="encodedartist" />
|
||||||
|
<pyhp save="urihandler.compose_querystring(urihandler.internal_to_uri({'artist':credited}))" as="encodedcredited" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -54,7 +55,7 @@
|
|||||||
<span class="rank"><a href="/charts_artists?max=100"><pyhp echo="positionstring" /></a></span>
|
<span class="rank"><a href="/charts_artists?max=100"><pyhp echo="positionstring" /></a></span>
|
||||||
<br/>
|
<br/>
|
||||||
<span><pyhp echo="includestring" /></span>
|
<span><pyhp echo="includestring" /></span>
|
||||||
<p class="stats"><a href="/scrobbles?artist={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 if="info.get('medals') is not None and 'gold' in info['medals']">
|
||||||
<pyhp for="y" in="info['medals']['gold']">
|
<pyhp for="y" in="info['medals']['gold']">
|
||||||
@ -76,7 +77,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<h2><a href='/charts_tracks?artist={encodedartist}'>Top Tracks</a></h2>
|
<h2><a href='/charts_tracks?{encodedartist}'>Top Tracks</a></h2>
|
||||||
|
|
||||||
<pyhp echo="htmlmodules.module_trackcharts(**filterkeys,max_=15)[0]" />
|
<pyhp echo="htmlmodules.module_trackcharts(**filterkeys,max_=15)[0]" />
|
||||||
<br/>
|
<br/>
|
||||||
@ -95,7 +96,7 @@
|
|||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<h2><a href='/pulse?artist={encodedartist}&step=year&trail=1'>Pulse</a></h2>
|
<h2><a href='/pulse?{encodedartist}&step=year&trail=1'>Pulse</a></h2>
|
||||||
|
|
||||||
<pyhp for="range" in="ranges" separator = " | ">
|
<pyhp for="range" in="ranges" separator = " | ">
|
||||||
<pyhp if="initialrange==range[0]">
|
<pyhp if="initialrange==range[0]">
|
||||||
@ -121,7 +122,7 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<!-- We use the same classes / function calls here because we want it to switch together with pulse -->
|
<!-- We use the same classes / function calls here because we want it to switch together with pulse -->
|
||||||
<h2><a href='/performance?artist={encodedcredited}&step=year&trail=1'>Performance</a></h2>
|
<h2><a href='/performance?{encodedcredited}&step=year&trail=1'>Performance</a></h2>
|
||||||
|
|
||||||
<pyhp for="range" in="ranges" separator = " | ">
|
<pyhp for="range" in="ranges" separator = " | ">
|
||||||
<pyhp if="initialrange==range[0]">
|
<pyhp if="initialrange==range[0]">
|
||||||
@ -149,7 +150,7 @@
|
|||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
||||||
<h2><a href='/scrobbles?artist={encodedartist}'>Last Scrobbles</a></h2>
|
<h2><a href='/scrobbles?{encodedartist}'>Last Scrobbles</a></h2>
|
||||||
|
|
||||||
<pyhp echo="htmlmodules.module_scrobblelist(**filterkeys,max_=10,earlystop=True)[0]" />
|
<pyhp echo="htmlmodules.module_scrobblelist(**filterkeys,max_=10,earlystop=True)[0]" />
|
||||||
|
|
||||||
|
133
website/track.pyhp
Normal file
133
website/track.pyhp
Normal file
@ -0,0 +1,133 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<!-- query keys -->
|
||||||
|
<pyhp save="filterkeys.get('track')" as="track" />
|
||||||
|
<!-- DB calls -->
|
||||||
|
<pyhp save="db.trackInfo(track['artists'],track['title'])" as="info" />
|
||||||
|
<!-- preprocessing -->
|
||||||
|
<pyhp save="'#' + str(info.get('position'))" as="positionstring" />
|
||||||
|
<pyhp save="'months'" as="initialrange" />
|
||||||
|
<!-- url encode -->
|
||||||
|
<pyhp save="urihandler.compose_querystring(urihandler.internal_to_uri({'track':track}))" as="encodedtrack" />
|
||||||
|
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<title>Maloja - <pyhp echo="track['title']" /></title>
|
||||||
|
|
||||||
|
<pyhp include="common/header.html" />
|
||||||
|
<script src="javascript/rangeselect.js"></script>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<table class="top_info">
|
||||||
|
<tr>
|
||||||
|
<td class="image">
|
||||||
|
<div style="background-image:url('{utilities.getTrackImage(track['artists'],track['title'],fast=True)}')"></div>
|
||||||
|
</td>
|
||||||
|
<td class="text">
|
||||||
|
<span><pyhp echo="htmlgenerators.artistLinks(track['artists'])" /></span><br/>
|
||||||
|
<h1><pyhp echo="track['title']" /></h1> <span class="rank"><a href="/charts_tracks?max=100"><pyhp echo="positionstring" /></a></span>
|
||||||
|
|
||||||
|
<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="y" in="info['medals']['gold']">
|
||||||
|
<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 if="info.get('medals') is not None and 'silver' in info['medals']">
|
||||||
|
<pyhp for="y" in="info['medals']['silver']">
|
||||||
|
<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 if="info.get('medals') is not None and 'bronze' in info['medals']">
|
||||||
|
<pyhp for="y" in="info['medals']['bronze']">
|
||||||
|
<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>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
<table class="twopart">
|
||||||
|
|
||||||
|
<pyhp save="[
|
||||||
|
('days','7 days',malojatime.today().next(-6),'day',7),
|
||||||
|
('weeks','12 weeks',malojatime.thisweek().next(-11),'week',12),
|
||||||
|
('months','12 months',malojatime.thismonth().next(-11),'month',12),
|
||||||
|
('years','10 years',malojatime.thisyear().next(-9),'year',12)
|
||||||
|
]" as="ranges" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<h2><a href='/pulse?{encodedtrack}&step=year&trail=1'>Pulse</a></h2>
|
||||||
|
|
||||||
|
<pyhp for="range" in="ranges" separator = " | ">
|
||||||
|
<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>
|
||||||
|
</pyhp>
|
||||||
|
<pyhp if="initialrange!=range[0]">
|
||||||
|
<span onclick="showRange('pulse','{range[0]}')" class="stat_selector_pulse selector_pulse_{range[0]}"><pyhp echo="range[1]" /></span>
|
||||||
|
</pyhp>
|
||||||
|
</pyhp>
|
||||||
|
|
||||||
|
<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(track=track,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(track=track,max_=range[4],since=range[2],step=range[3],trail=1)" /></span>
|
||||||
|
</pyhp>
|
||||||
|
|
||||||
|
</pyhp>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<!-- We use the same classes / function calls here because we want it to switch together with pulse -->
|
||||||
|
<h2><a href='/performance?{encodedtrack}&step=year&trail=1'>Performance</a></h2>
|
||||||
|
|
||||||
|
<pyhp for="range" in="ranges" separator = " | ">
|
||||||
|
<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>
|
||||||
|
</pyhp>
|
||||||
|
<pyhp if="initialrange!=range[0]">
|
||||||
|
<span onclick="showRange('pulse','{range[0]}')" class="stat_selector_pulse selector_pulse_{range[0]}"><pyhp echo="range[1]" /></span>
|
||||||
|
</pyhp>
|
||||||
|
|
||||||
|
</pyhp>
|
||||||
|
|
||||||
|
<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(track=track,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(track=track,max_=range[4],since=range[2],step=range[3],trail=1)" /></span>
|
||||||
|
</pyhp>
|
||||||
|
|
||||||
|
</pyhp>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
<h2><a href='/scrobbles?{encodedtrack}'>Last Scrobbles</a></h2>
|
||||||
|
|
||||||
|
<pyhp echo="htmlmodules.module_scrobblelist(**filterkeys,max_=10,earlystop=True)[0]" />
|
||||||
|
|
||||||
|
<pyhp include="common/footer.html" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in New Issue
Block a user