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 ## Requirements
* Python 3.5 or higher * 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 ## How to install

View File

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

View File

@ -187,28 +187,29 @@ def static_html(name):
# 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):
environ = {} #things we expose to the pyhp pages
environ["adminmode"] = adminmode #things we expose to the pyhp pages
if adminmode: environ["apikey"] = request.cookies.get("apikey") environ = {
"adminmode":adminmode,
# maloja "apikey":request.cookies.get("apikey") if adminmode else None,
environ["db"] = database # maloja
environ["htmlmodules"] = htmlmodules "db": database,
environ["htmlgenerators"] = htmlgenerators "htmlmodules": htmlmodules,
environ["malojatime"] = malojatime "htmlgenerators": htmlgenerators,
environ["utilities"] = utilities "malojatime": malojatime,
environ["urihandler"] = urihandler "utilities": utilities,
environ["settings"] = settings.get_settings "urihandler": urihandler,
# external "settings": settings.get_settings,
environ["urllib"] = urllib # external
"urllib": urllib
}
# request # request
environ["filterkeys"], environ["limitkeys"], environ["delimitkeys"], environ["amountkeys"] = uri_to_internal(keys) environ["filterkeys"], environ["limitkeys"], environ["delimitkeys"], environ["amountkeys"] = uri_to_internal(keys)
environ["_urikeys"] = keys #temporary! environ["_urikeys"] = keys #temporary!
#response.set_header("Content-Type","application/xhtml+xml") #response.set_header("Content-Type","application/xhtml+xml")
res = pyhpfile(pthjoin(WEBFOLDER,name + ".pyhp"),environ) 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 return res
# if not, use the old way # if not, use the old way