From afa22d4518b25c5f4218cc64de18de4968c34d0d Mon Sep 17 00:00:00 2001 From: Justin Date: Wed, 23 Aug 2023 22:27:00 +0800 Subject: [PATCH] added this for intial boot so not internal server error --- server.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/server.py b/server.py index c281391..e5ff622 100755 --- a/server.py +++ b/server.py @@ -406,6 +406,28 @@ def index(): try: f = open('csv/scheduler.json','r') 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() 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}}