added save_clock1_settings

This commit is contained in:
Justin 2023-08-29 19:51:02 +08:00 committed by GitHub
parent 95fbfe11f6
commit 8935919cc4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -906,6 +906,8 @@ def save():
save_sector_settings(input_settings) save_sector_settings(input_settings)
elif feature == 'Place (Reddit)': elif feature == 'Place (Reddit)':
save_place_settings(input_settings) save_place_settings(input_settings)
elif feature == 'Clock 1':
save_clock1_settings(input_settings)
elif feature in ['Custom GIFs', 'Custom Images']: elif feature in ['Custom GIFs', 'Custom Images']:
images = request.files images = request.files
@ -1685,6 +1687,28 @@ def save_sector_settings(input_settings):
# f.close() # 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): def save_place_settings(input_settings):
filename = 'place_settings.json' filename = 'place_settings.json'
try: try: