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

Minor improvements

This commit is contained in:
Krateng 2019-12-22 22:01:01 +01:00
parent f9672a918d
commit e2f627a1a0
3 changed files with 20 additions and 16 deletions

View File

@ -22,7 +22,7 @@ Also neat: You can use your **custom artist or track images**.
## Requirements
* Python 3.5 or higher
* If you'd like to display images, you will need API keys for [Last.fm](https://www.last.fm/api/account/create) and [Fanart.tv](https://fanart.tv/get-an-api-key/). These are free of charge!
* If you'd like to display images, you will need API keys for [Last.fm](https://www.last.fm/api/account/create) and [Fanart.tv](https://fanart.tv/get-an-api-key/) (you need a project key, not a personal one). These are free of charge!
## How to install

View File

@ -23,6 +23,9 @@ def datadir(*args):
from doreah import config
config(
pyhp={
"version": 2
},
logging={
"logfolder": datadir("logs")
},

View File

@ -187,28 +187,29 @@ def static_html(name):
# if a pyhp file exists, use this
if (pyhp_file and pyhp_pref) or (pyhp_file and not html_file):
environ = {} #things we expose to the pyhp pages
environ["adminmode"] = adminmode
if adminmode: environ["apikey"] = request.cookies.get("apikey")
# maloja
environ["db"] = database
environ["htmlmodules"] = htmlmodules
environ["htmlgenerators"] = htmlgenerators
environ["malojatime"] = malojatime
environ["utilities"] = utilities
environ["urihandler"] = urihandler
environ["settings"] = settings.get_settings
# external
environ["urllib"] = urllib
#things we expose to the pyhp pages
environ = {
"adminmode":adminmode,
"apikey":request.cookies.get("apikey") if adminmode else None,
# maloja
"db": database,
"htmlmodules": htmlmodules,
"htmlgenerators": htmlgenerators,
"malojatime": malojatime,
"utilities": utilities,
"urihandler": urihandler,
"settings": settings.get_settings,
# external
"urllib": urllib
}
# request
environ["filterkeys"], environ["limitkeys"], environ["delimitkeys"], environ["amountkeys"] = uri_to_internal(keys)
environ["_urikeys"] = keys #temporary!
#response.set_header("Content-Type","application/xhtml+xml")
res = pyhpfile(pthjoin(WEBFOLDER,name + ".pyhp"),environ)
log("Generated page " + name + " in " + str(clock.stop()) + "s (PYHP)",module="debug")
log("Generated page {name} in {time}s (PYHP)".format(name=name,time=clock.stop()),module="debug")
return res
# if not, use the old way