user choosing options to display working on new frontend

This commit is contained in:
Neythen
2021-08-11 20:58:01 +01:00
parent 768cfa72d0
commit cdf2906ad9
38 changed files with 4233 additions and 148 deletions

View File

@@ -17,6 +17,7 @@ import time
import json
from multiprocessing import Process
from subprocess import Popen, PIPE
import numpy as np
#stock_ticker = StockTicker()
api_caller = pexpect.spawn("sudo -E python3 api_caller.py")
@@ -267,8 +268,48 @@ def AddLogo():
return hello()
return hello()
@app.route("/matrix", methods=['POST'])
@app.route("/start", methods = ['PUT', 'POST'])
def start():
data = str(request.data)
all_settings = ['Stocks', 'Crypto', 'Forex', 'Current Weather', 'Daily Forecast', 'News', 'Sports (Upcoming Games)', 'Sports (Past Games)',
'Sports (Live Games)', 'Sports (Team Stats)', 'Custom Images', 'Custom GIFs', 'Custom Messages']
positions = []
display_settings = []
for setting in all_settings:
pos = data.find(setting)
if pos != -1:
display_settings.append(setting)
positions.append(pos)
# sort settings by display
inds = np.argsort(positions)
display_settings = np.array(display_settings)[inds]
with open('csv/display_settings.json', 'w+') as f:
json.dump(list(display_settings), f)
ticker.sendline('K')
ticker.sendline('A')
return hello()
@app.route("/stop")
def stop():
ticker.sendline('K')
return hello()
@app.route("/shutdown")
def shutdown():
os.system("sudo shutdown now")
return hello()
@app.route("/matrix")
def matrix():
if "Run Stocks" in request.form:
ticker.sendline('K')
ticker.sendline('S')