mirror of https://github.com/krateng/maloja.git
Added setting for non-interactive server start GH-10
This commit is contained in:
parent
8793b149f5
commit
7c6e2ad60f
|
@ -7,14 +7,14 @@ author = {
|
||||||
"email":"maloja@krateng.dev",
|
"email":"maloja@krateng.dev",
|
||||||
"github": "krateng"
|
"github": "krateng"
|
||||||
}
|
}
|
||||||
version = 2,3,0
|
version = 2,3,1
|
||||||
versionstr = ".".join(str(n) for n in version)
|
versionstr = ".".join(str(n) for n in version)
|
||||||
|
|
||||||
|
|
||||||
requires = [
|
requires = [
|
||||||
"bottle>=0.12.16",
|
"bottle>=0.12.16",
|
||||||
"waitress>=1.3",
|
"waitress>=1.3",
|
||||||
"doreah>=1.5.2",
|
"doreah>=1.5.3",
|
||||||
"nimrodel>=0.6.3",
|
"nimrodel>=0.6.3",
|
||||||
"setproctitle>=1.1.10",
|
"setproctitle>=1.1.10",
|
||||||
"wand>=0.5.4",
|
"wand>=0.5.4",
|
||||||
|
|
|
@ -10,7 +10,7 @@ import stat
|
||||||
import pathlib
|
import pathlib
|
||||||
import pkg_resources
|
import pkg_resources
|
||||||
from doreah.control import mainfunction
|
from doreah.control import mainfunction
|
||||||
from doreah.io import col
|
from doreah.io import col, ask, prompt
|
||||||
|
|
||||||
from .globalconf import datadir
|
from .globalconf import datadir
|
||||||
from .backup import backup
|
from .backup import backup
|
||||||
|
@ -37,6 +37,8 @@ def setup():
|
||||||
"SPOTIFY_API_ID":"Spotify Client ID",
|
"SPOTIFY_API_ID":"Spotify Client ID",
|
||||||
"SPOTIFY_API_SECRET":"Spotify Client Secret"
|
"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.")
|
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:
|
for k in apikeys:
|
||||||
|
@ -45,8 +47,7 @@ def setup():
|
||||||
print("\t" + "Currently not using a " + apikeys[k] + " for image display.")
|
print("\t" + "Currently not using a " + apikeys[k] + " for image display.")
|
||||||
elif key == "ASK":
|
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.")
|
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()
|
key = prompt("",types=(str,),default=None,skip=SKIP)
|
||||||
if key == "": key = None
|
|
||||||
settings.update_settings(datadir("settings/settings.ini"),{k:key},create_new=True)
|
settings.update_settings(datadir("settings/settings.ini"),{k:key},create_new=True)
|
||||||
else:
|
else:
|
||||||
print("\t" + apikeys[k] + " found.")
|
print("\t" + apikeys[k] + " found.")
|
||||||
|
@ -56,9 +57,8 @@ def setup():
|
||||||
if os.path.exists(datadir("clients/authenticated_machines.tsv")):
|
if os.path.exists(datadir("clients/authenticated_machines.tsv")):
|
||||||
pass
|
pass
|
||||||
else:
|
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 = 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)
|
||||||
answer = input()
|
if answer:
|
||||||
if answer.lower() in ["y","yes","yea","1","positive","true",""]:
|
|
||||||
import random
|
import random
|
||||||
key = ""
|
key = ""
|
||||||
for i in range(64):
|
for i in range(64):
|
||||||
|
@ -66,20 +66,17 @@ def setup():
|
||||||
print("Your API Key: " + col["yellow"](key))
|
print("Your API Key: " + col["yellow"](key))
|
||||||
with open(datadir("clients/authenticated_machines.tsv"),"w") as keyfile:
|
with open(datadir("clients/authenticated_machines.tsv"),"w") as keyfile:
|
||||||
keyfile.write(key + "\t" + "Default Generated Key")
|
keyfile.write(key + "\t" + "Default Generated Key")
|
||||||
elif answer.lower() in ["n","no","nay","0","negative","false"]:
|
else:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
if settings.get_settings("NAME") is None:
|
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 = 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)
|
||||||
name = input()
|
|
||||||
if name == "": name = "Generic Maloja User"
|
|
||||||
settings.update_settings(datadir("settings/settings.ini"),{"NAME":name},create_new=True)
|
settings.update_settings(datadir("settings/settings.ini"),{"NAME":name},create_new=True)
|
||||||
|
|
||||||
if settings.get_settings("SEND_STATS") is None:
|
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 = 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)
|
||||||
answer = input()
|
if answer:
|
||||||
if answer.lower() in ["y","yes","yea","1","positive","true",""]:
|
|
||||||
settings.update_settings(datadir("settings/settings.ini"),{"SEND_STATS":True,"PUBLIC_URL":None},create_new=True)
|
settings.update_settings(datadir("settings/settings.ini"),{"SEND_STATS":True,"PUBLIC_URL":None},create_new=True)
|
||||||
else:
|
else:
|
||||||
settings.update_settings(datadir("settings/settings.ini"),{"SEND_STATS":False},create_new=True)
|
settings.update_settings(datadir("settings/settings.ini"),{"SEND_STATS":False},create_new=True)
|
||||||
|
|
|
@ -64,3 +64,4 @@ USE_PYHP = no #not recommended at the moment
|
||||||
FEDERATION = yes #does nothing yet
|
FEDERATION = yes #does nothing yet
|
||||||
UPDATE_AFTER_CRASH = no #update when server is automatically restarted
|
UPDATE_AFTER_CRASH = no #update when server is automatically restarted
|
||||||
DAILY_RESTART = 2 # hour of day. no / none means no daily restarts
|
DAILY_RESTART = 2 # hour of day. no / none means no daily restarts
|
||||||
|
SKIP_SETUP = no
|
||||||
|
|
Loading…
Reference in New Issue