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",
|
"email":"maloja@krateng.dev",
|
||||||
"github": "krateng"
|
"github": "krateng"
|
||||||
}
|
}
|
||||||
version = 1,5,13
|
version = 1,5,14
|
||||||
versionstr = ".".join(str(n) for n in version)
|
versionstr = ".".join(str(n) for n in version)
|
||||||
dev = os.path.exists("./.dev")
|
dev = os.path.exists("./.dev")
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
bottle>=0.12.16
|
bottle>=0.12.16
|
||||||
waitress>=1.3
|
waitress>=1.3
|
||||||
doreah>=1.2.5
|
doreah>=1.2.7
|
||||||
nimrodel>=0.4.9
|
nimrodel>=0.4.9
|
||||||
setproctitle>=1.1.10
|
setproctitle>=1.1.10
|
||||||
wand>=0.5.4
|
wand>=0.5.4
|
||||||
|
10
server.py
10
server.py
@ -18,6 +18,7 @@ import info
|
|||||||
# doreah toolkit
|
# doreah toolkit
|
||||||
from doreah import settings
|
from doreah import settings
|
||||||
from doreah.logging import log
|
from doreah.logging import log
|
||||||
|
from doreah.timing import Clock
|
||||||
# technical
|
# technical
|
||||||
from importlib.machinery import SourceFileLoader
|
from importlib.machinery import SourceFileLoader
|
||||||
import _thread
|
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
|
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 a pyhp file exists, use this
|
||||||
if (pyhp_file and pyhp_pref) or (pyhp_file and not html_file):
|
if (pyhp_file and pyhp_pref) or (pyhp_file and not html_file):
|
||||||
from doreah.pyhp import 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)
|
environ["filterkeys"], environ["limitkeys"], environ["delimitkeys"], environ["amountkeys"] = uri_to_internal(keys)
|
||||||
|
|
||||||
#response.set_header("Content-Type","application/xhtml+xml")
|
#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
|
# if not, use the old way
|
||||||
else:
|
else:
|
||||||
@ -219,7 +225,7 @@ def static_html(name):
|
|||||||
|
|
||||||
|
|
||||||
response.set_header("Link",",".join(linkheaders))
|
response.set_header("Link",",".join(linkheaders))
|
||||||
|
log("Generated page " + name + " in " + str(clock.stop()) + "s (Python+HTML)",module="debug")
|
||||||
return html
|
return html
|
||||||
#return static_file("website/" + name + ".html",root="")
|
#return static_file("website/" + name + ".html",root="")
|
||||||
|
|
||||||
|
@ -70,9 +70,9 @@
|
|||||||
</pyhp></span>
|
</pyhp></span>
|
||||||
|
|
||||||
<!-- CERTS -->
|
<!-- 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"
|
<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_{db.trackInfo(track)['certification']}.png"
|
src="/media/record_{info['certification']}.png"
|
||||||
title="{track['title']} has reached {db.trackInfo(track)['certification'].capitalize()} status"
|
title="{track['title']} has reached {info['certification'].capitalize()} status"
|
||||||
/></a></pyhp></pyhp>
|
/></a></pyhp></pyhp>
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ def instructions(keys):
|
|||||||
js_command += "showRange('pulse','" + get_settings("DEFAULT_STEP_PULSE") + "');"
|
js_command += "showRange('pulse','" + get_settings("DEFAULT_STEP_PULSE") + "');"
|
||||||
|
|
||||||
|
|
||||||
clock()
|
#clock()
|
||||||
|
|
||||||
from malojatime import today,thisweek,thismonth,thisyear
|
from malojatime import today,thisweek,thismonth,thisyear
|
||||||
|
|
||||||
@ -26,7 +26,7 @@ def instructions(keys):
|
|||||||
topartists_month = module_artistcharts_tiles(timerange=thismonth())
|
topartists_month = module_artistcharts_tiles(timerange=thismonth())
|
||||||
topartists_week = module_artistcharts_tiles(timerange=thisweek())
|
topartists_week = module_artistcharts_tiles(timerange=thisweek())
|
||||||
|
|
||||||
clockp("Artists")
|
#clockp("Artists")
|
||||||
|
|
||||||
# tracks
|
# tracks
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ def instructions(keys):
|
|||||||
toptracks_week = module_trackcharts_tiles(timerange=thisweek())
|
toptracks_week = module_trackcharts_tiles(timerange=thisweek())
|
||||||
|
|
||||||
|
|
||||||
clockp("Tracks")
|
#clockp("Tracks")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ def instructions(keys):
|
|||||||
# scrobbles
|
# scrobbles
|
||||||
html_scrobbles, _, _ = module_scrobblelist(max_=15,shortTimeDesc=True,pictures=True,earlystop=True)
|
html_scrobbles, _, _ = module_scrobblelist(max_=15,shortTimeDesc=True,pictures=True,earlystop=True)
|
||||||
|
|
||||||
clockp("Scrobbles")
|
#clockp("Scrobbles")
|
||||||
|
|
||||||
# stats
|
# stats
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ def instructions(keys):
|
|||||||
amount_total = database.get_scrobbles_num()
|
amount_total = database.get_scrobbles_num()
|
||||||
scrobbles_total = "<a href='/scrobbles'>" + str(amount_total) + "</a>"
|
scrobbles_total = "<a href='/scrobbles'>" + str(amount_total) + "</a>"
|
||||||
|
|
||||||
clockp("Amounts")
|
#clockp("Amounts")
|
||||||
|
|
||||||
# pulse
|
# 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_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)
|
#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 = [{"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 = []
|
pushresources = []
|
||||||
|
Loading…
x
Reference in New Issue
Block a user