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
if adminmode: environ["apikey"] = request.cookies.get("apikey")
#things we expose to the pyhp pages
environ = {
"adminmode":adminmode,
"apikey":request.cookies.get("apikey") if adminmode else None,
# maloja # maloja
environ["db"] = database "db": database,
environ["htmlmodules"] = htmlmodules "htmlmodules": htmlmodules,
environ["htmlgenerators"] = htmlgenerators "htmlgenerators": htmlgenerators,
environ["malojatime"] = malojatime "malojatime": malojatime,
environ["utilities"] = utilities "utilities": utilities,
environ["urihandler"] = urihandler "urihandler": urihandler,
environ["settings"] = settings.get_settings "settings": settings.get_settings,
# external # external
environ["urllib"] = urllib "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