added clocks to scheduler

This commit is contained in:
Justin 2023-08-23 21:43:39 +08:00 committed by GitHub
parent b57eed6dbd
commit e5582691f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -408,8 +408,8 @@ def index():
scheduler_settings = json.load(f)
f.close()
except:
scheduler_settings = {"shutdown": {"hour": "00", "minute": "00", "enabled": False}, "reboot":{"hour": "00", "minute": "00", "enabled": False}, "timezone": "GMT", "brightness1":{"hour": "00", "minute": "00", "bright": "10", "enabled": False}, "brightness2":{"hour": "00", "minute": "00", "bright": "10", "enabled": False}, "brightness3":{"hour": "00", "minute": "00", "bright": "10", "enabled": False}, "brightness4":{"hour": "00", "minute": "00", "bright": "10", "enabled": False}}
scheduler_settings = {"shutdown": {"hour": "00", "minute": "00", "enabled": False}, "reboot":{"hour": "00", "minute": "00", "enabled": False}, "timezone": "GMT", "brightness1":{"hour": "00", "minute": "00", "bright": "10", "enabled": False}, "brightness2":{"hour": "00", "minute": "00", "bright": "10", "enabled": False}, "brightness3":{"hour": "00", "minute": "00", "bright": "10", "enabled": False}, "brightness4":{"hour": "00", "minute": "00", "bright": "10", "enabled": False}, "screensaver1":{"hour": "00", "minute": "00", "endhour": "00", "endminute": "00", "type":"World Clock", "enabled": False}, "screensaver2":{"hour": "00", "minute": "00", "endhour": "00", "endminute": "00", "type":"Clock 1", "enabled": False}, "screensaver3":{"hour": "00", "minute": "00", "endhour": "00", "endminute": "00", "type":"Clock 2", "enabled": False}}
# try: # incase this doesnt exist
# api_keys = api_key2[1]
# except:
@ -484,7 +484,7 @@ def scheduled_brightness():
schedules = json.load(f)
f.close()
except:
schedules = {"shutdown": {"hour": "00", "minute": "00", "enabled": False}, "reboot":{"hour": "00", "minute": "00", "enabled": False}, "timezone": "GMT", "brightness1":{"hour": "00", "minute": "00", "bright": "10", "enabled": False}, "brightness2":{"hour": "00", "minute": "00", "bright": "10", "enabled": False}, "brightness3":{"hour": "00", "minute": "00", "bright": "10", "enabled": False}, "brightness4":{"hour": "00", "minute": "00", "bright": "10", "enabled": False}}
schedules = {"shutdown": {"hour": "00", "minute": "00", "enabled": False}, "reboot":{"hour": "00", "minute": "00", "enabled": False}, "timezone": "GMT", "brightness1":{"hour": "00", "minute": "00", "bright": "10", "enabled": False}, "brightness2":{"hour": "00", "minute": "00", "bright": "10", "enabled": False}, "brightness3":{"hour": "00", "minute": "00", "bright": "10", "enabled": False}, "brightness4":{"hour": "00", "minute": "00", "bright": "10", "enabled": False}, "screensaver1":{"hour": "00", "minute": "00", "endhour": "00", "endminute": "00", "type":"World Clock", "enabled": False}, "screensaver2":{"hour": "00", "minute": "00", "endhour": "00", "endminute": "00", "type":"Clock 1", "enabled": False}, "screensaver3":{"hour": "00", "minute": "00", "endhour": "00", "endminute": "00", "type":"Clock 2", "enabled": False}}
timezone_brightness = schedules['timezone']
@ -1643,7 +1643,7 @@ def saveSchedulerSettings():
data= request.data.decode('utf-8')
input_settings = json.loads(data)
initialize_json = '{"shutdown": {"hour": "00", "minute": "00", "enabled": false}, "reboot":{"hour": "00", "minute": "00", "enabled": false}, "timezone": "GMT", "brightness1":{"hour": "00", "minute": "00", "bright": "10", "enabled": false}, "brightness2":{"hour": "00", "minute": "00", "bright": "10", "enabled": false}, "brightness3":{"hour": "00", "minute": "00", "bright": "10", "enabled": false}, "brightness4":{"hour": "00", "minute": "00", "bright": "10", "enabled": false}}'
initialize_json = '{"shutdown": {"hour": "00", "minute": "00", "enabled": false}, "reboot":{"hour": "00", "minute": "00", "enabled": false}, "timezone": "GMT", "brightness1":{"hour": "00", "minute": "00", "bright": "10", "enabled": false}, "brightness2":{"hour": "00", "minute": "00", "bright": "10", "enabled": false}, "brightness3":{"hour": "00", "minute": "00", "bright": "10", "enabled": false}, "brightness4":{"hour": "00", "minute": "00", "bright": "10", "enabled": false}, "screensaver1":{"hour": "00", "minute": "00", "endhour": "00", "endminute": "00", "type":"World Clock", "enabled": false}, "screensaver2":{"hour": "00", "minute": "00", "endhour": "00", "endminute": "00", "type":"Clock 1", "enabled": false}, "screensaver3":{"hour": "00", "minute": "00", "endhour": "00", "endminute": "00", "type":"Clock 2", "enabled": false}}'
if 'scheduler.json' not in os.listdir('csv/'):
with open('csv/scheduler.json', 'w') as f:
@ -1653,7 +1653,7 @@ def saveSchedulerSettings():
with open('csv/scheduler.json','r') as f:
scheduler_settings = json.load(f)
except:
scheduler_settings = {"shutdown": {"hour": "00", "minute": "00", "enabled": False}, "reboot":{"hour": "00", "minute": "00", "enabled": False}, "timezone": "GMT", "brightness1":{"hour": "00", "minute": "00", "bright": "10", "enabled": False}, "brightness2":{"hour": "00", "minute": "00", "bright": "10", "enabled": False}, "brightness3":{"hour": "00", "minute": "00", "bright": "10", "enabled": False}, "brightness4":{"hour": "00", "minute": "00", "bright": "10", "enabled": False}}
scheduler_settings = {"shutdown": {"hour": "00", "minute": "00", "enabled": False}, "reboot":{"hour": "00", "minute": "00", "enabled": False}, "timezone": "GMT", "brightness1":{"hour": "00", "minute": "00", "bright": "10", "enabled": False}, "brightness2":{"hour": "00", "minute": "00", "bright": "10", "enabled": False}, "brightness3":{"hour": "00", "minute": "00", "bright": "10", "enabled": False}, "brightness4":{"hour": "00", "minute": "00", "bright": "10", "enabled": False}, "screensaver1":{"hour": "00", "minute": "00", "endhour": "00", "endminute": "00", "type":"World Clock", "enabled": False}, "screensaver2":{"hour": "00", "minute": "00", "endhour": "00", "endminute": "00", "type":"Clock 1", "enabled": False}, "screensaver3":{"hour": "00", "minute": "00", "endhour": "00", "endminute": "00", "type":"Clock 2", "enabled": False}}
scheduler_settings['shutdown']['hour'] = input_settings['shutdown_hour']
scheduler_settings['shutdown']['minute'] = input_settings['shutdown_minute']