ipo calendar
This commit is contained in:
parent
58052f767a
commit
20543b373b
57
server.py
57
server.py
@ -153,6 +153,12 @@ def index():
|
|||||||
except:
|
except:
|
||||||
movie_api = ''
|
movie_api = ''
|
||||||
|
|
||||||
|
try:
|
||||||
|
with open('ipo_api_key.txt', 'r') as f:
|
||||||
|
ipo_api = f.readlines()
|
||||||
|
except:
|
||||||
|
ipo_api = ''
|
||||||
|
|
||||||
with open('/etc/wpa_supplicant/wpa_supplicant.conf', 'r') as f:
|
with open('/etc/wpa_supplicant/wpa_supplicant.conf', 'r') as f:
|
||||||
wifiline = f.readlines()
|
wifiline = f.readlines()
|
||||||
|
|
||||||
@ -181,6 +187,10 @@ def index():
|
|||||||
movie_settings = json.load(f)
|
movie_settings = json.load(f)
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
|
f= open('csv/ipo_settings.json', 'r')
|
||||||
|
ipo_settings = json.load(f)
|
||||||
|
f.close()
|
||||||
|
|
||||||
f = open('csv/forex_settings.json', 'r')
|
f = open('csv/forex_settings.json', 'r')
|
||||||
forex_settings = json.load(f)
|
forex_settings = json.load(f)
|
||||||
f.close()
|
f.close()
|
||||||
@ -241,6 +251,11 @@ def index():
|
|||||||
except:
|
except:
|
||||||
movie_api_key = ''
|
movie_api_key = ''
|
||||||
|
|
||||||
|
try:
|
||||||
|
ipo_api_key = ipo_api[0]
|
||||||
|
except:
|
||||||
|
ipo_api_key = ''
|
||||||
|
|
||||||
try:
|
try:
|
||||||
wifi_SSID = wifiline[5][6:].replace('"','')
|
wifi_SSID = wifiline[5][6:].replace('"','')
|
||||||
except:
|
except:
|
||||||
@ -266,6 +281,7 @@ def index():
|
|||||||
'current_weather': current_weather,
|
'current_weather': current_weather,
|
||||||
'daily_weather': daily_weather,
|
'daily_weather': daily_weather,
|
||||||
'movie_settings': movie_settings,
|
'movie_settings': movie_settings,
|
||||||
|
'ipo_settings': ipo_settings,
|
||||||
'news_settings': news_settings,
|
'news_settings': news_settings,
|
||||||
'upcoming_games': upcoming_games,
|
'upcoming_games': upcoming_games,
|
||||||
'past_games': past_games,
|
'past_games': past_games,
|
||||||
@ -278,6 +294,7 @@ def index():
|
|||||||
'general_settings':general_settings,
|
'general_settings':general_settings,
|
||||||
'api_keys':api_keys,
|
'api_keys':api_keys,
|
||||||
'movie_api_key':movie_api_key,
|
'movie_api_key':movie_api_key,
|
||||||
|
'ipo_api_key':ipo_api_key,
|
||||||
'wifi_SSID':wifi_SSID,
|
'wifi_SSID':wifi_SSID,
|
||||||
'wifi_PSK':wifi_PSK
|
'wifi_PSK':wifi_PSK
|
||||||
}
|
}
|
||||||
@ -438,6 +455,8 @@ def save():
|
|||||||
save_news_settings(input_settings)
|
save_news_settings(input_settings)
|
||||||
elif feature == 'Movies':
|
elif feature == 'Movies':
|
||||||
save_movie_settings(input_settings)
|
save_movie_settings(input_settings)
|
||||||
|
elif feature == 'IPO Calendar':
|
||||||
|
save_ipo_settings(input_settings)
|
||||||
elif 'Sports' in feature:
|
elif 'Sports' in feature:
|
||||||
save_sports_settings(input_settings)
|
save_sports_settings(input_settings)
|
||||||
|
|
||||||
@ -661,6 +680,18 @@ def saveMovieAPIKey():
|
|||||||
|
|
||||||
return index()
|
return index()
|
||||||
|
|
||||||
|
@app.route("/saveIpoAPIKey", methods = ['PUT', 'POST'])
|
||||||
|
def saveIpoAPIKey():
|
||||||
|
|
||||||
|
data= request.data.decode('utf-8')
|
||||||
|
settings = json.loads(data)
|
||||||
|
|
||||||
|
key = settings['api_key']
|
||||||
|
|
||||||
|
with open('ipo_api_key.txt', 'w') as f:
|
||||||
|
f.write(str(key))
|
||||||
|
|
||||||
|
return index()
|
||||||
|
|
||||||
@app.route("/screensaver", methods = ['PUT', 'POST'])
|
@app.route("/screensaver", methods = ['PUT', 'POST'])
|
||||||
def screensaver():
|
def screensaver():
|
||||||
@ -880,6 +911,32 @@ def save_movie_settings(input_settings):
|
|||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
|
|
||||||
|
def save_ipo_settings(input_settings):
|
||||||
|
filename = 'ipo_settings.json'
|
||||||
|
f = open('csv/' + filename, 'r')
|
||||||
|
current_settings = json.load(f)
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
current_settings['speed'] = input_settings['speed'].lower()
|
||||||
|
current_settings['speed2'] = input_settings['speed2'].lower()
|
||||||
|
current_settings['animation'] = input_settings['animation'].lower()
|
||||||
|
current_settings['title'] = input_settings['title']
|
||||||
|
|
||||||
|
f = open('csv/' + filename, 'w')
|
||||||
|
json.dump(current_settings, f)
|
||||||
|
f.close()
|
||||||
|
#api_caller.sendline('n')
|
||||||
|
f = open('csv/last_updates.json', 'r')
|
||||||
|
last_updates = json.load(f)
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
last_updates['ipo']['force'] = True
|
||||||
|
|
||||||
|
f = open('csv/last_updates.json', 'w')
|
||||||
|
json.dump(last_updates, f)
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
|
||||||
def save_sports_settings(input_settings):
|
def save_sports_settings(input_settings):
|
||||||
|
|
||||||
feature = input_settings['feature']
|
feature = input_settings['feature']
|
||||||
|
Loading…
Reference in New Issue
Block a user