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

Added setting for non-interactive server start GH-10

This commit is contained in:
Krateng 2020-02-28 17:26:26 +01:00
parent 8793b149f5
commit 7c6e2ad60f
3 changed files with 13 additions and 15 deletions

View File

@ -7,14 +7,14 @@ author = {
"email":"maloja@krateng.dev",
"github": "krateng"
}
version = 2,3,0
version = 2,3,1
versionstr = ".".join(str(n) for n in version)
requires = [
"bottle>=0.12.16",
"waitress>=1.3",
"doreah>=1.5.2",
"doreah>=1.5.3",
"nimrodel>=0.6.3",
"setproctitle>=1.1.10",
"wand>=0.5.4",

View File

@ -10,7 +10,7 @@ import stat
import pathlib
import pkg_resources
from doreah.control import mainfunction
from doreah.io import col
from doreah.io import col, ask, prompt
from .globalconf import datadir
from .backup import backup
@ -37,6 +37,8 @@ def setup():
"SPOTIFY_API_ID":"Spotify Client ID",
"SPOTIFY_API_SECRET":"Spotify Client Secret"
}
SKIP = settings.get_settings("SKIP_SETUP")
print("Various external services can be used to display images. If not enough of them are set up, only local images will be used.")
for k in apikeys:
@ -45,8 +47,7 @@ def setup():
print("\t" + "Currently not using a " + apikeys[k] + " for image display.")
elif key == "ASK":
print("\t" + "Please enter your " + apikeys[k] + ". If you do not want to use one at this moment, simply leave this empty and press Enter.")
key = input()
if key == "": key = None
key = prompt("",types=(str,),default=None,skip=SKIP)
settings.update_settings(datadir("settings/settings.ini"),{k:key},create_new=True)
else:
print("\t" + apikeys[k] + " found.")
@ -56,9 +57,8 @@ def setup():
if os.path.exists(datadir("clients/authenticated_machines.tsv")):
pass
else:
print("Do you want to set up a key to enable scrobbling? Your scrobble extension needs that key so that only you can scrobble tracks to your database. [Y/n]")
answer = input()
if answer.lower() in ["y","yes","yea","1","positive","true",""]:
answer = ask("Do you want to set up a key to enable scrobbling? Your scrobble extension needs that key so that only you can scrobble tracks to your database.",default=True,skip=SKIP)
if answer:
import random
key = ""
for i in range(64):
@ -66,20 +66,17 @@ def setup():
print("Your API Key: " + col["yellow"](key))
with open(datadir("clients/authenticated_machines.tsv"),"w") as keyfile:
keyfile.write(key + "\t" + "Default Generated Key")
elif answer.lower() in ["n","no","nay","0","negative","false"]:
else:
pass
if settings.get_settings("NAME") is None:
print("Please enter your name. This will be displayed e.g. when comparing your charts to another user. Leave this empty if you would not like to specify a name right now.")
name = input()
if name == "": name = "Generic Maloja User"
name = prompt("Please enter your name. This will be displayed e.g. when comparing your charts to another user. Leave this empty if you would not like to specify a name right now.",default="Generic Maloja User",skip=SKIP)
settings.update_settings(datadir("settings/settings.ini"),{"NAME":name},create_new=True)
if settings.get_settings("SEND_STATS") is None:
print("I would like to know how many people use Maloja. Would it be okay to send a daily ping to my server (this contains no data that isn't accessible via your web interface already)? [Y/n]")
answer = input()
if answer.lower() in ["y","yes","yea","1","positive","true",""]:
answer = ask("I would like to know how many people use Maloja. Would it be okay to send a daily ping to my server (this contains no data that isn't accessible via your web interface already)?",default=True,skip=SKIP)
if answer:
settings.update_settings(datadir("settings/settings.ini"),{"SEND_STATS":True,"PUBLIC_URL":None},create_new=True)
else:
settings.update_settings(datadir("settings/settings.ini"),{"SEND_STATS":False},create_new=True)

View File

@ -64,3 +64,4 @@ USE_PYHP = no #not recommended at the moment
FEDERATION = yes #does nothing yet
UPDATE_AFTER_CRASH = no #update when server is automatically restarted
DAILY_RESTART = 2 # hour of day. no / none means no daily restarts
SKIP_SETUP = no