Skip to content
Snippets Groups Projects
Verified Commit 502d4d0e authored by magicfelix's avatar magicfelix
Browse files

Add publishing

parent 39e447a3
No related branches found
No related tags found
No related merge requests found
......@@ -31,7 +31,12 @@ def vote():
number = input("Nummer: ")
if number == "save":
saveToFile()
printWaitClear("Daten wurden in Datei geschrieben.")
elif number == "publish":
publish()
printWaitClear("Daten wurden hochgeladen!")
elif number == "exit":
saveToFile()
exit()
else:
if int(number) < cfg["min"] or int(number) > cfg["max"]:
......@@ -51,7 +56,13 @@ def saveToFile():
data_file = open("data-magicPrognos.json", "w")
data_file.write(dumps(data))
data_file.close()
input("Daten wurden in Datei geschrieben.")
def publish():
saveToFile()
system(cfg["publish_cmd"])
def printWaitClear(msg):
input(msg)
system("clear")
while True:
......
......@@ -5,6 +5,7 @@ conf = {
"min": 1,
"max": 1,
"stats_url": "https://prognos.example.org",
"publish_cmd": "scp data-magicPrognos.json prognos@example.org:/path/to/magicPrognos-Web"
}
for key in conf:
......@@ -19,5 +20,5 @@ cfg_file.write(dumps(conf))
cfg_file.close()
data_file = open("data-magicPrognos.json", "w")
data_file.write(dumps({}))
data_file.write(dumps({"title": conf["title"]}))
data_file.close()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment