From 8935919cc411bc7b4ae6cfe0588f0e8dd530b3fb Mon Sep 17 00:00:00 2001 From: Justin Date: Tue, 29 Aug 2023 19:51:02 +0800 Subject: [PATCH] added save_clock1_settings --- server.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/server.py b/server.py index ae87bbe..064db6c 100755 --- a/server.py +++ b/server.py @@ -906,6 +906,8 @@ def save(): save_sector_settings(input_settings) elif feature == 'Place (Reddit)': save_place_settings(input_settings) + elif feature == 'Clock 1': + save_clock1_settings(input_settings) elif feature in ['Custom GIFs', 'Custom Images']: images = request.files @@ -1685,6 +1687,28 @@ def save_sector_settings(input_settings): # f.close() +def save_clock1_settings(input_settings): + filename = 'clock1_settings.json' + try: + f = open('csv/' + filename, 'r') + current_settings = json.load(f) + f.close() + except: + current_settings = {"speed": "fast", "speed2": "fast", "transition": "up", "pause": "20"} + + current_settings['speed'] = input_settings['speed'].lower() + current_settings['speed2'] = input_settings['speed2'].lower() + current_settings['animation'] = input_settings['animation'].lower() + current_settings['pause'] = input_settings['pause'] + try: + f = open('csv/' + filename, 'w') + json.dump(current_settings, f) + f.close() + except: + with open('csv/clock1_settings.json', 'w') as f: + json.dump(current_settings, f) + + def save_place_settings(input_settings): filename = 'place_settings.json' try: