trial of new databasecaller method
This commit is contained in:
parent
c2891a66bb
commit
c53038b8ed
@ -43,7 +43,7 @@ def updateUpdate(NY_time):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
def updateStocks(api_key):
|
def updateStocks(api_key, logf):
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -95,7 +95,7 @@ def updateStocks(api_key):
|
|||||||
logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])))
|
logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])))
|
||||||
|
|
||||||
|
|
||||||
def updateCrypto(api_key):
|
def updateCrypto(api_key, logf):
|
||||||
|
|
||||||
|
|
||||||
#cypto_info['symbol, base'].keys() = ['current','24hr change']
|
#cypto_info['symbol, base'].keys() = ['current','24hr change']
|
||||||
@ -122,6 +122,7 @@ def updateCrypto(api_key):
|
|||||||
print(url)
|
print(url)
|
||||||
response = requests.get(url)
|
response = requests.get(url)
|
||||||
data = response.json()
|
data = response.json()
|
||||||
|
print(url)
|
||||||
print(data)
|
print(data)
|
||||||
|
|
||||||
|
|
||||||
@ -138,8 +139,9 @@ def updateCrypto(api_key):
|
|||||||
coin_info[symbol.upper() + ',' + base.upper()] = {'current': d['price'], '24hr_change': d['price_over_24hr'], 'percent_change': d['percent_over_24hr']}
|
coin_info[symbol.upper() + ',' + base.upper()] = {'current': d['price'], '24hr_change': d['price_over_24hr'], 'percent_change': d['percent_over_24hr']}
|
||||||
|
|
||||||
all_crypto_settings['symbols'] = coin_info
|
all_crypto_settings['symbols'] = coin_info
|
||||||
|
f = open('csv/crypto_settings.json', 'w+')
|
||||||
json.dump(all_crypto_settings, open('csv/crypto_settings.json', 'w+'))
|
json.dump(all_crypto_settings, f)
|
||||||
|
f.close()
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
||||||
@ -151,7 +153,7 @@ def updateCrypto(api_key):
|
|||||||
logf.write('. type: ' + str(exc_type))
|
logf.write('. type: ' + str(exc_type))
|
||||||
logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])))
|
logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])))
|
||||||
|
|
||||||
def updateForex(api_key):
|
def updateForex(api_key, logf):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -206,7 +208,7 @@ def updateForex(api_key):
|
|||||||
logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])))
|
logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])))
|
||||||
|
|
||||||
|
|
||||||
def updateNews(api_key):
|
def updateNews(api_key, logf):
|
||||||
|
|
||||||
#'https://bm7p954xoh.execute-api.us-east-2.amazonaws.com/default/ScriptsAPI/news?category=technology'
|
#'https://bm7p954xoh.execute-api.us-east-2.amazonaws.com/default/ScriptsAPI/news?category=technology'
|
||||||
#'https://bm7p954xoh.execute-api.us-east-2.amazonaws.com/default/ScriptsAPI/news?country=GB'
|
#'https://bm7p954xoh.execute-api.us-east-2.amazonaws.com/default/ScriptsAPI/news?country=GB'
|
||||||
@ -263,7 +265,7 @@ def updateNews(api_key):
|
|||||||
logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])))
|
logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])))
|
||||||
|
|
||||||
|
|
||||||
def updateWeather(api_key):
|
def updateWeather(api_key, logf):
|
||||||
max_cities = 30
|
max_cities = 30
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -363,7 +365,7 @@ def updateWeather(api_key):
|
|||||||
logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])))
|
logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])))
|
||||||
|
|
||||||
|
|
||||||
def updateLeagueTables(api_key):
|
def updateLeagueTables(api_key, logf):
|
||||||
|
|
||||||
url = 'https://bm7p954xoh.execute-api.us-east-2.amazonaws.com/default/ScriptsAPI/sports?stats='
|
url = 'https://bm7p954xoh.execute-api.us-east-2.amazonaws.com/default/ScriptsAPI/sports?stats='
|
||||||
try:
|
try:
|
||||||
@ -428,7 +430,7 @@ def updateLeagueTables(api_key):
|
|||||||
logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])))
|
logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])))
|
||||||
|
|
||||||
|
|
||||||
def updateLeagueEvents(api_key, time):
|
def updateLeagueEvents(api_key, time, logf):
|
||||||
|
|
||||||
url = 'https://bm7p954xoh.execute-api.us-east-2.amazonaws.com/default/ScriptsAPI/sports?{}='.format(time)
|
url = 'https://bm7p954xoh.execute-api.us-east-2.amazonaws.com/default/ScriptsAPI/sports?{}='.format(time)
|
||||||
|
|
||||||
@ -507,14 +509,14 @@ def updateLeagueEvents(api_key, time):
|
|||||||
logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])))
|
logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])))
|
||||||
|
|
||||||
|
|
||||||
def updateSports(api_key):
|
def updateSports(api_key, logf):
|
||||||
#read user settings to decide which sprots to update
|
#read user settings to decide which sprots to update
|
||||||
|
|
||||||
updateLeagueTables(api_key)
|
updateLeagueTables(api_key, logf)
|
||||||
|
|
||||||
updateLeagueEvents(api_key,'livescore')
|
updateLeagueEvents(api_key,'livescore', logf)
|
||||||
updateLeagueEvents(api_key,'past')
|
updateLeagueEvents(api_key,'past', logf)
|
||||||
updateLeagueEvents(api_key,'upcoming')
|
updateLeagueEvents(api_key,'upcoming', logf)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -560,19 +562,19 @@ def checkStocks(last_update, update_frequency):
|
|||||||
return updated
|
return updated
|
||||||
|
|
||||||
|
|
||||||
def updateAll(api_key, weather_key):
|
def updateAll(api_key, weather_key, logf):
|
||||||
updateStocks(api_key)
|
updateStocks(api_key, logf)
|
||||||
|
|
||||||
updateCrypto(api_key)
|
updateCrypto(api_key, logf)
|
||||||
|
|
||||||
updateForex(api_key)
|
updateForex(api_key, logf)
|
||||||
|
|
||||||
updateNews(api_key)
|
updateNews(api_key, logf)
|
||||||
|
|
||||||
updateSports(api_key)
|
updateSports(api_key, logf)
|
||||||
|
|
||||||
if weather_key:
|
if weather_key:
|
||||||
updateWeather(weather_key)
|
updateWeather(weather_key, logf)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
@ -584,7 +586,7 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
update_frequencies = {'stocks':1, 'crypto':1, 'forex':60, 'news':120, 'weather': 120, 'sports': 1440} #minutes
|
update_frequencies = {'stocks':1, 'crypto':1, 'forex':1, 'news':1, 'weather': 1, 'sports': 1} #minutes
|
||||||
|
|
||||||
NY_zone = pytz.timezone('America/New_York')
|
NY_zone = pytz.timezone('America/New_York')
|
||||||
CET_zone = pytz.timezone('EST')
|
CET_zone = pytz.timezone('EST')
|
||||||
@ -641,7 +643,7 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
msg = getInput()
|
msg = getInput()
|
||||||
if msg == 'A':
|
if msg == 'A':
|
||||||
update_process = Process(target = updateAll, args = (api_key,weather_key))
|
update_process = Process(target = updateAll, args = (api_key,weather_key, logf))
|
||||||
update_process.start()
|
update_process.start()
|
||||||
update_processes.append(update_process)
|
update_processes.append(update_process)
|
||||||
stock_time = NY_time.strftime("%d/%m/%Y %H:%M:%S")
|
stock_time = NY_time.strftime("%d/%m/%Y %H:%M:%S")
|
||||||
@ -663,7 +665,7 @@ if __name__ == '__main__':
|
|||||||
stock_time = NY_time.strftime("%d/%m/%Y %H:%M:%S")
|
stock_time = NY_time.strftime("%d/%m/%Y %H:%M:%S")
|
||||||
last_updates['stocks'] = stock_time
|
last_updates['stocks'] = stock_time
|
||||||
#updateStocks(api_key)
|
#updateStocks(api_key)
|
||||||
update_process = Process(target = updateStocks, args = (api_key,))
|
update_process = Process(target = updateStocks, args = (api_key,logf))
|
||||||
update_process.start()
|
update_process.start()
|
||||||
update_processes.append(update_process)
|
update_processes.append(update_process)
|
||||||
|
|
||||||
@ -678,8 +680,10 @@ if __name__ == '__main__':
|
|||||||
if diff >= update_frequencies['crypto'] or msg == 'c':
|
if diff >= update_frequencies['crypto'] or msg == 'c':
|
||||||
crypto_time = NY_time.strftime("%d/%m/%Y %H:%M:%S")
|
crypto_time = NY_time.strftime("%d/%m/%Y %H:%M:%S")
|
||||||
#updateCrypto(api_key)
|
#updateCrypto(api_key)
|
||||||
|
print('UPDATING CRYPTO')
|
||||||
|
|
||||||
last_updates['crypto'] = crypto_time
|
last_updates['crypto'] = crypto_time
|
||||||
update_process = Process(target = updateCrypto, args = (api_key,))
|
update_process = Process(target = updateCrypto, args = (api_key,logf))
|
||||||
update_process.start()
|
update_process.start()
|
||||||
update_processes.append(update_process)
|
update_processes.append(update_process)
|
||||||
|
|
||||||
@ -695,7 +699,7 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
#updateWeather(weather_key)
|
#updateWeather(weather_key)
|
||||||
last_updates['weather'] = weather_time
|
last_updates['weather'] = weather_time
|
||||||
update_process = Process(target = updateWeather, args = (weather_key,))
|
update_process = Process(target = updateWeather, args = (weather_key,logf))
|
||||||
update_process.start()
|
update_process.start()
|
||||||
update_processes.append(update_process)
|
update_processes.append(update_process)
|
||||||
|
|
||||||
@ -710,7 +714,7 @@ if __name__ == '__main__':
|
|||||||
news_time = NY_time.strftime("%d/%m/%Y %H:%M:%S")
|
news_time = NY_time.strftime("%d/%m/%Y %H:%M:%S")
|
||||||
#updateNews(api_key)
|
#updateNews(api_key)
|
||||||
last_updates['news'] = news_time
|
last_updates['news'] = news_time
|
||||||
update_process = Process(target = updateNews, args = (api_key,))
|
update_process = Process(target = updateNews, args = (api_key,logf))
|
||||||
update_process.start()
|
update_process.start()
|
||||||
update_processes.append(update_process)
|
update_processes.append(update_process)
|
||||||
|
|
||||||
@ -722,7 +726,7 @@ if __name__ == '__main__':
|
|||||||
sports_time = NY_time.strftime("%d/%m/%Y %H:%M:%S")
|
sports_time = NY_time.strftime("%d/%m/%Y %H:%M:%S")
|
||||||
#updateSports(api_key)
|
#updateSports(api_key)
|
||||||
last_updates['sports'] = sports_time
|
last_updates['sports'] = sports_time
|
||||||
update_process = Process(target = updateSports, args = (api_key,))
|
update_process = Process(target = updateSports, args = (api_key,logf))
|
||||||
update_process.start()
|
update_process.start()
|
||||||
update_processes.append(update_process)
|
update_processes.append(update_process)
|
||||||
|
|
||||||
@ -743,7 +747,7 @@ if __name__ == '__main__':
|
|||||||
forex_time = CET_time.strftime("%d/%m/%Y %H:%M:%S")
|
forex_time = CET_time.strftime("%d/%m/%Y %H:%M:%S")
|
||||||
last_updates['forex'] = forex_time
|
last_updates['forex'] = forex_time
|
||||||
#updateForex(api_key)
|
#updateForex(api_key)
|
||||||
update_process = Process(target = updateForex, args = (api_key,))
|
update_process = Process(target = updateForex, args = (api_key,logf))
|
||||||
update_process.start()
|
update_process.start()
|
||||||
update_processes.append(update_process)
|
update_processes.append(update_process)
|
||||||
|
|
||||||
@ -753,9 +757,11 @@ if __name__ == '__main__':
|
|||||||
if not process.is_alive():
|
if not process.is_alive():
|
||||||
process.join()
|
process.join()
|
||||||
process.terminate()
|
process.terminate()
|
||||||
|
update_processes.remove(process)
|
||||||
|
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
||||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||||
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
|
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
|
||||||
logf.write(str(e))
|
logf.write(str(e))
|
||||||
@ -766,3 +772,4 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
120
server.py
120
server.py
@ -29,11 +29,11 @@ import sys
|
|||||||
|
|
||||||
|
|
||||||
#api_caller = pexpect.spawn("sudo -E taskset -c 3 python3 api_caller.py")
|
#api_caller = pexpect.spawn("sudo -E taskset -c 3 python3 api_caller.py")
|
||||||
api_caller = pexpect.spawn("sudo -E taskset -c 3 python3 database_caller.py")
|
#api_caller = pexpect.spawn("sudo -E taskset -c 3 python3 database_caller.py")
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
|
|
||||||
|
|
||||||
api_caller.sendline('A')
|
#api_caller.sendline('A')
|
||||||
|
|
||||||
|
|
||||||
#os.system("sudo ./check_update.sh")
|
#os.system("sudo ./check_update.sh")
|
||||||
@ -84,6 +84,7 @@ class DummyProcess():
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
@app.route("/", methods=['GET', 'POST'])
|
@app.route("/", methods=['GET', 'POST'])
|
||||||
def index():
|
def index():
|
||||||
@ -156,6 +157,8 @@ def index():
|
|||||||
'api_keys':api_keys,
|
'api_keys':api_keys,
|
||||||
'wifi_SSID':wifi_SSID
|
'wifi_SSID':wifi_SSID
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#print('database caller:', api_caller.isalive())
|
||||||
return render_template('index.html', **templateData)
|
return render_template('index.html', **templateData)
|
||||||
|
|
||||||
|
|
||||||
@ -196,21 +199,21 @@ def start():
|
|||||||
|
|
||||||
global displaying_screensaver
|
global displaying_screensaver
|
||||||
global ticker
|
global ticker
|
||||||
global api_caller
|
#global api_caller
|
||||||
global professional
|
global professional
|
||||||
global ticker_stopped
|
global ticker_stopped
|
||||||
if displaying_screensaver:
|
if displaying_screensaver:
|
||||||
screensaver_p.close()
|
screensaver_p.close()
|
||||||
ticker = pexpect.spawn("sudo -E python3 stockTicker.py")
|
ticker = pexpect.spawn("sudo -E python3 stockTicker.py")
|
||||||
#api_caller = pexpect.spawn("sudo -E taskset -c 3 python3 api_caller.py")
|
#api_caller = pexpect.spawn("sudo -E taskset -c 3 python3 api_caller.py")
|
||||||
api_caller = pexpect.spawn("sudo -E taskset -c 3 python3 database_caller.py")
|
#api_caller = pexpect.spawn("sudo -E taskset -c 3 python3 database_caller.py")
|
||||||
displaying_screensaver = False
|
displaying_screensaver = False
|
||||||
|
|
||||||
if ticker_stopped:
|
if ticker_stopped:
|
||||||
ticker = pexpect.spawn("sudo -E python3 stockTicker.py")
|
ticker = pexpect.spawn("sudo -E python3 stockTicker.py")
|
||||||
ticker_stopped = False
|
ticker_stopped = False
|
||||||
|
|
||||||
api_caller.sendline('A')
|
#api_caller.sendline('A')
|
||||||
|
|
||||||
ticker.sendline('K')
|
ticker.sendline('K')
|
||||||
|
|
||||||
@ -222,7 +225,7 @@ def stop():
|
|||||||
print('stop')
|
print('stop')
|
||||||
global displaying_screensaver
|
global displaying_screensaver
|
||||||
global ticker
|
global ticker
|
||||||
global api_caller
|
#global api_caller
|
||||||
global professional
|
global professional
|
||||||
global ticker_stopped
|
global ticker_stopped
|
||||||
|
|
||||||
@ -245,7 +248,7 @@ def stop():
|
|||||||
screensaver_p.close()
|
screensaver_p.close()
|
||||||
ticker = pexpect.spawn("sudo -E python3 stockTicker.py")
|
ticker = pexpect.spawn("sudo -E python3 stockTicker.py")
|
||||||
#api_caller = pexpect.spawn("sudo -E taskset -c 3 python3 api_caller.py")
|
#api_caller = pexpect.spawn("sudo -E taskset -c 3 python3 api_caller.py")
|
||||||
api_caller = pexpect.spawn("sudo -E taskset -c 3 python3 database_caller.py")
|
#api_caller = pexpect.spawn("sudo -E taskset -c 3 python3 database_caller.py")
|
||||||
displaying_screensaver = False
|
displaying_screensaver = False
|
||||||
|
|
||||||
return index()
|
return index()
|
||||||
@ -496,7 +499,7 @@ def saveWeatherAPIKey():
|
|||||||
def screensaver():
|
def screensaver():
|
||||||
global displaying_screensaver
|
global displaying_screensaver
|
||||||
global ticker
|
global ticker
|
||||||
global api_caller
|
#global api_caller
|
||||||
global screensaver_p
|
global screensaver_p
|
||||||
|
|
||||||
data = str(request.data)
|
data = str(request.data)
|
||||||
@ -504,7 +507,7 @@ def screensaver():
|
|||||||
if displaying_screensaver:
|
if displaying_screensaver:
|
||||||
screensaver_p.close()
|
screensaver_p.close()
|
||||||
else:
|
else:
|
||||||
api_caller.close()
|
#api_caller.close()
|
||||||
ticker.close()
|
ticker.close()
|
||||||
|
|
||||||
|
|
||||||
@ -553,8 +556,9 @@ def save_trade_settings(input_settings):
|
|||||||
|
|
||||||
|
|
||||||
filename = input_settings['feature'].lower() + '_settings.json'
|
filename = input_settings['feature'].lower() + '_settings.json'
|
||||||
|
f = open('csv/' + filename, 'r')
|
||||||
current_settings = json.load(open('csv/' + filename, 'r'))
|
current_settings = json.load(f)
|
||||||
|
f.close()
|
||||||
|
|
||||||
current_settings['speed'] = input_settings['speed'].lower()
|
current_settings['speed'] = input_settings['speed'].lower()
|
||||||
current_settings['animation'] = input_settings['animation'].lower()
|
current_settings['animation'] = input_settings['animation'].lower()
|
||||||
@ -566,14 +570,18 @@ def save_trade_settings(input_settings):
|
|||||||
|
|
||||||
current_settings = combine_dict(current_settings, input_settings['symbols'], 'symbols')
|
current_settings = combine_dict(current_settings, input_settings['symbols'], 'symbols')
|
||||||
|
|
||||||
json.dump(current_settings, open('csv/' + filename, 'w+'))
|
f = open('csv/' + filename, 'w+')
|
||||||
|
json.dump(current_settings, f)
|
||||||
|
f.close()
|
||||||
if input_settings['feature'].lower() == 'stocks':
|
if input_settings['feature'].lower() == 'stocks':
|
||||||
api_caller.sendline('s')
|
#api_caller.sendline('s')
|
||||||
|
pass
|
||||||
elif input_settings['feature'].lower() == 'crypto':
|
elif input_settings['feature'].lower() == 'crypto':
|
||||||
api_caller.sendline('c')
|
#api_caller.sendline('c')
|
||||||
|
pass
|
||||||
elif input_settings['feature'].lower() == 'forex':
|
elif input_settings['feature'].lower() == 'forex':
|
||||||
api_caller.sendline('f')
|
#api_caller.sendline('f')
|
||||||
|
pass
|
||||||
|
|
||||||
def save_weather_settings(input_settings):
|
def save_weather_settings(input_settings):
|
||||||
|
|
||||||
@ -605,7 +613,7 @@ def save_weather_settings(input_settings):
|
|||||||
current_settings = combine_dict(current_settings, input_settings['locations'], 'locations')
|
current_settings = combine_dict(current_settings, input_settings['locations'], 'locations')
|
||||||
json.dump(current_settings, open('csv/' + filename, 'w+'))
|
json.dump(current_settings, open('csv/' + filename, 'w+'))
|
||||||
|
|
||||||
api_caller.sendline('w')
|
#api_caller.sendline('w')
|
||||||
|
|
||||||
def save_news_settings(input_settings):
|
def save_news_settings(input_settings):
|
||||||
filename = 'news_settings.json'
|
filename = 'news_settings.json'
|
||||||
@ -628,7 +636,7 @@ def save_news_settings(input_settings):
|
|||||||
print(current_settings)
|
print(current_settings)
|
||||||
|
|
||||||
json.dump(current_settings, open('csv/' + filename, 'w+'))
|
json.dump(current_settings, open('csv/' + filename, 'w+'))
|
||||||
api_caller.sendline('n')
|
#api_caller.sendline('n')
|
||||||
|
|
||||||
def save_sports_settings(input_settings):
|
def save_sports_settings(input_settings):
|
||||||
|
|
||||||
@ -654,7 +662,7 @@ def save_sports_settings(input_settings):
|
|||||||
|
|
||||||
json.dump(current_settings, open('csv/' + filename, 'w+'))
|
json.dump(current_settings, open('csv/' + filename, 'w+'))
|
||||||
|
|
||||||
api_caller.sendline('S')
|
#api_caller.sendline('S')
|
||||||
|
|
||||||
# for images and GIFs
|
# for images and GIFs
|
||||||
def save_image_settings(input_settings):
|
def save_image_settings(input_settings):
|
||||||
@ -702,81 +710,7 @@ def shutdown():
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
@app.route("/matrix")
|
|
||||||
def matrix():
|
|
||||||
|
|
||||||
if "Run Stocks" in request.form:
|
|
||||||
ticker.sendline('K')
|
|
||||||
ticker.sendline('S')
|
|
||||||
elif "Run Crypto" in request.form:
|
|
||||||
ticker.sendline('K')
|
|
||||||
ticker.sendline('C')
|
|
||||||
|
|
||||||
elif "Run Forex" in request.form:
|
|
||||||
ticker.sendline('K')
|
|
||||||
ticker.sendline('F')
|
|
||||||
|
|
||||||
elif "Run News" in request.form:
|
|
||||||
|
|
||||||
ticker.sendline('K')
|
|
||||||
ticker.sendline('N')
|
|
||||||
|
|
||||||
elif "Run Weather" in request.form:
|
|
||||||
|
|
||||||
|
|
||||||
ticker.sendline('K')
|
|
||||||
ticker.sendline('W')
|
|
||||||
|
|
||||||
elif "Run Daily Weather" in request.form:
|
|
||||||
|
|
||||||
ticker.sendline('K')
|
|
||||||
ticker.sendline('D')
|
|
||||||
|
|
||||||
elif "Past NHL" in request.form:
|
|
||||||
ticker.sendline('K')
|
|
||||||
ticker.sendline('P')
|
|
||||||
|
|
||||||
elif "Future NHL" in request.form:
|
|
||||||
ticker.sendline('K')
|
|
||||||
ticker.sendline('l')
|
|
||||||
|
|
||||||
elif "Live NHL" in request.form:
|
|
||||||
ticker.sendline('K')
|
|
||||||
ticker.sendline('L')
|
|
||||||
|
|
||||||
elif "Premier league table" in request.form:
|
|
||||||
|
|
||||||
ticker.sendline('K')
|
|
||||||
ticker.sendline('t')
|
|
||||||
|
|
||||||
elif "Professional" in request.form:
|
|
||||||
|
|
||||||
ticker.sendline('K')
|
|
||||||
ticker.sendline('b')
|
|
||||||
|
|
||||||
elif "All" in request.form:
|
|
||||||
|
|
||||||
ticker.sendline('K')
|
|
||||||
ticker.sendline('A')
|
|
||||||
|
|
||||||
elif "Multiple" in request.form:
|
|
||||||
|
|
||||||
ticker.sendline('K')
|
|
||||||
ticker.sendline('+')
|
|
||||||
|
|
||||||
elif "Stop Display" in request.form:
|
|
||||||
|
|
||||||
|
|
||||||
LastCommand = 'Stop display at next checkpoint'
|
|
||||||
ticker.sendline('K')
|
|
||||||
|
|
||||||
elif "Shutdown the pi" in request.form:
|
|
||||||
|
|
||||||
try:
|
|
||||||
os.system("sudo shutdown now")
|
|
||||||
except:
|
|
||||||
print("couldn't shutdown")
|
|
||||||
return index()
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
cd /home/pi/fintic
|
cd /home/pi/fintic
|
||||||
sudo -E python3 server.py
|
sudo -E taskset -c 3 python3 database_caller.py & sudo -E python3 server.py
|
||||||
|
Loading…
Reference in New Issue
Block a user