save_economic_settings

This commit is contained in:
Justin 2023-06-14 16:28:09 +08:00 committed by GitHub
parent ce6d99f1a4
commit db8a0d3b6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -596,6 +596,8 @@ def save():
save_movie_settings(input_settings)
elif feature == 'IPO Calendar':
save_ipo_settings(input_settings)
elif feature == 'Economic Calendar':
save_economic_settings(input_settings)
elif 'Sports' in feature:
save_sports_settings(input_settings)
@ -1233,6 +1235,34 @@ def save_ipo_settings(input_settings):
f.close()
def save_economic_settings(input_settings):
filename = 'economic_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']
current_settings['timezone'] = input_settings['timezone']
current_settings['countries'] = input_settings['countries']
current_settings['importance'] = input_settings['importance']
f = open('csv/' + filename, 'w')
json.dump(current_settings, f)
f.close()
f = open('csv/last_updates.json', 'r')
last_updates = json.load(f)
f.close()
last_updates['economic']['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']