added this for intial boot so not internal server error

This commit is contained in:
Justin 2023-08-23 22:27:00 +08:00 committed by GitHub
parent b88e3d9e71
commit afa22d4518
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -406,6 +406,28 @@ def index():
try: try:
f = open('csv/scheduler.json','r') f = open('csv/scheduler.json','r')
scheduler_settings = json.load(f) scheduler_settings = json.load(f)
if 'screensaver' not in str(scheduler_settings):
scheduler_settings['screensaver1'] = {}
scheduler_settings['screensaver1']['hour'] = '00'
scheduler_settings['screensaver1']['minute'] = '00'
scheduler_settings['screensaver1']['endhour'] = '00'
scheduler_settings['screensaver1']['endminute'] = '00'
scheduler_settings['screensaver1']['type'] = 'World Clock'
scheduler_settings['screensaver1']['enabled'] = False
scheduler_settings['screensaver2'] = {}
scheduler_settings['screensaver2']['hour'] = '00'
scheduler_settings['screensaver2']['minute'] = '00'
scheduler_settings['screensaver2']['endhour'] = '00'
scheduler_settings['screensaver2']['endminute'] = '00'
scheduler_settings['screensaver2']['type'] = 'Clock 2'
scheduler_settings['screensaver2']['enabled'] = False
scheduler_settings['screensaver3'] = {}
scheduler_settings['screensaver3']['hour'] = '00'
scheduler_settings['screensaver3']['minute'] = '00'
scheduler_settings['screensaver3']['endhour'] = '00'
scheduler_settings['screensaver3']['endminute'] = '00'
scheduler_settings['screensaver3']['type'] = 'Clock 1'
scheduler_settings['screensaver3']['enabled'] = False
f.close() f.close()
except: 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}, "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": "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}}