save market settings
This commit is contained in:
parent
ea3cd93280
commit
9085f91070
41
server.py
41
server.py
@ -696,8 +696,8 @@ def save():
|
||||
save_jokes_settings(input_settings)
|
||||
elif 'Sports' in feature:
|
||||
save_sports_settings(input_settings)
|
||||
# elif feature == 'Gainers, Losers, Active':
|
||||
# save_market_settings(input_settings)
|
||||
elif feature == 'Gainers, Losers, Active':
|
||||
save_market_settings(input_settings)
|
||||
elif feature in ['Custom GIFs', 'Custom Images']:
|
||||
|
||||
images = request.files
|
||||
@ -1408,6 +1408,43 @@ def save_jokes_settings(input_settings):
|
||||
f.close()
|
||||
|
||||
|
||||
def save_market_settings(input_settings):
|
||||
filename = 'market_settings.json'
|
||||
try:
|
||||
f = open('csv/' + filename, 'r')
|
||||
current_settings = json.load(f)
|
||||
f.close()
|
||||
except:
|
||||
current_settings = {"feature": "Gainers, Losers, Active", "speed": "medium", "speed2": "medium", "animation": "up", "percent": True, "point": true, "logos": True, "chart": False, "title": True, "lohivol": False, "categories": ["Top Gainers", "Top Losers", "Most Active"], "gainers": {}, "losers": {}, "mostactive": {}}
|
||||
|
||||
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']
|
||||
current_settings['logos'] = input_settings['logos']
|
||||
current_settings['percent'] = input_settings['percent']
|
||||
current_settings['point'] = input_settings['point']
|
||||
current_settings['categories'] = input_settings['categories']
|
||||
current_settings['lohivol'] = input_settings['lohivol']
|
||||
try:
|
||||
f = open('csv/' + filename, 'w')
|
||||
json.dump(current_settings, f)
|
||||
f.close()
|
||||
except:
|
||||
with open('csv/market_settings.json', 'w') as f:
|
||||
json.dump(current_settings, f)
|
||||
|
||||
f = open('csv/last_updates.json', 'r')
|
||||
last_updates = json.load(f)
|
||||
f.close()
|
||||
|
||||
last_updates['market']['force'] = True
|
||||
|
||||
f = open('csv/last_updates.json', 'w')
|
||||
json.dump(last_updates, f)
|
||||
f.close()
|
||||
|
||||
|
||||
def save_sports_settings(input_settings):
|
||||
|
||||
feature = input_settings['feature']
|
||||
|
Loading…
Reference in New Issue
Block a user