mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Added debug output to evaluate PyHP performance
This commit is contained in:
parent
ab7ca8f192
commit
1c9fdedbed
2
info.py
2
info.py
@ -5,6 +5,6 @@ author = {
|
||||
"email":"maloja@krateng.dev",
|
||||
"github": "krateng"
|
||||
}
|
||||
version = 1,5,13
|
||||
version = 1,5,14
|
||||
versionstr = ".".join(str(n) for n in version)
|
||||
dev = os.path.exists("./.dev")
|
||||
|
@ -1,6 +1,6 @@
|
||||
bottle>=0.12.16
|
||||
waitress>=1.3
|
||||
doreah>=1.2.5
|
||||
doreah>=1.2.7
|
||||
nimrodel>=0.4.9
|
||||
setproctitle>=1.1.10
|
||||
wand>=0.5.4
|
||||
|
10
server.py
10
server.py
@ -18,6 +18,7 @@ import info
|
||||
# doreah toolkit
|
||||
from doreah import settings
|
||||
from doreah.logging import log
|
||||
from doreah.timing import Clock
|
||||
# technical
|
||||
from importlib.machinery import SourceFileLoader
|
||||
import _thread
|
||||
@ -155,6 +156,9 @@ def static_html(name):
|
||||
|
||||
adminmode = request.cookies.get("adminmode") == "true" and database.checkAPIkey(request.cookies.get("apikey")) is not False
|
||||
|
||||
clock = Clock()
|
||||
clock.start()
|
||||
|
||||
# if a pyhp file exists, use this
|
||||
if (pyhp_file and pyhp_pref) or (pyhp_file and not html_file):
|
||||
from doreah.pyhp import file
|
||||
@ -177,7 +181,9 @@ def static_html(name):
|
||||
environ["filterkeys"], environ["limitkeys"], environ["delimitkeys"], environ["amountkeys"] = uri_to_internal(keys)
|
||||
|
||||
#response.set_header("Content-Type","application/xhtml+xml")
|
||||
return file("website/" + name + ".pyhp",environ)
|
||||
res = file("website/" + name + ".pyhp",environ)
|
||||
log("Generated page " + name + " in " + str(clock.stop()) + "s (PYHP)",module="debug")
|
||||
return res
|
||||
|
||||
# if not, use the old way
|
||||
else:
|
||||
@ -219,7 +225,7 @@ def static_html(name):
|
||||
|
||||
|
||||
response.set_header("Link",",".join(linkheaders))
|
||||
|
||||
log("Generated page " + name + " in " + str(clock.stop()) + "s (Python+HTML)",module="debug")
|
||||
return html
|
||||
#return static_file("website/" + name + ".html",root="")
|
||||
|
||||
|
@ -70,9 +70,9 @@
|
||||
</pyhp></span>
|
||||
|
||||
<!-- CERTS -->
|
||||
<pyhp for="track" in="db.get_tracks(artist=artist)"><pyhp if="db.trackInfo(track).get('certification') is not None"><a href='{htmlgenerators.link_address(track)}'><img class="certrecord_small"
|
||||
src="/media/record_{db.trackInfo(track)['certification']}.png"
|
||||
title="{track['title']} has reached {db.trackInfo(track)['certification'].capitalize()} status"
|
||||
<pyhp for="track" in="db.get_tracks(artist=artist)"><pyhp save="db.trackInfo(track)" as="info" /><pyhp if="info.get('certification') is not None"><a href='{htmlgenerators.link_address(track)}'><img class="certrecord_small"
|
||||
src="/media/record_{info['certification']}.png"
|
||||
title="{track['title']} has reached {info['certification'].capitalize()} status"
|
||||
/></a></pyhp></pyhp>
|
||||
|
||||
|
||||
|
@ -15,7 +15,7 @@ def instructions(keys):
|
||||
js_command += "showRange('pulse','" + get_settings("DEFAULT_STEP_PULSE") + "');"
|
||||
|
||||
|
||||
clock()
|
||||
#clock()
|
||||
|
||||
from malojatime import today,thisweek,thismonth,thisyear
|
||||
|
||||
@ -26,7 +26,7 @@ def instructions(keys):
|
||||
topartists_month = module_artistcharts_tiles(timerange=thismonth())
|
||||
topartists_week = module_artistcharts_tiles(timerange=thisweek())
|
||||
|
||||
clockp("Artists")
|
||||
#clockp("Artists")
|
||||
|
||||
# tracks
|
||||
|
||||
@ -36,7 +36,7 @@ def instructions(keys):
|
||||
toptracks_week = module_trackcharts_tiles(timerange=thisweek())
|
||||
|
||||
|
||||
clockp("Tracks")
|
||||
#clockp("Tracks")
|
||||
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@ def instructions(keys):
|
||||
# scrobbles
|
||||
html_scrobbles, _, _ = module_scrobblelist(max_=15,shortTimeDesc=True,pictures=True,earlystop=True)
|
||||
|
||||
clockp("Scrobbles")
|
||||
#clockp("Scrobbles")
|
||||
|
||||
# stats
|
||||
|
||||
@ -63,7 +63,7 @@ def instructions(keys):
|
||||
amount_total = database.get_scrobbles_num()
|
||||
scrobbles_total = "<a href='/scrobbles'>" + str(amount_total) + "</a>"
|
||||
|
||||
clockp("Amounts")
|
||||
#clockp("Amounts")
|
||||
|
||||
# pulse
|
||||
|
||||
@ -78,7 +78,7 @@ def instructions(keys):
|
||||
#html_pulse_month = module_pulse(max_=30,since=[dt.year,dt.month],step="day",trail=1)
|
||||
#html_pulse_year = module_pulse(max_=12,since=[dt.year],step="month",trail=1)
|
||||
|
||||
clockp("Pulse")
|
||||
#clockp("Pulse")
|
||||
|
||||
#pushresources = [{"file":img,"type":"image"} for img in artistimages + trackimages] #can't push scrobble images as we don't get them from the module function, need to think about that
|
||||
pushresources = []
|
||||
|
Loading…
Reference in New Issue
Block a user