one more context lib

This commit is contained in:
Rob Weber 2019-12-31 11:03:11 -06:00
parent 9ecf706d63
commit 190b4fd86f

View File

@ -12,7 +12,7 @@ UPGRADE_INT = 2 # to keep track of any upgrade notifications
class BackupScheduler: class BackupScheduler:
monitor = None monitor = None
enabled = "false" enabled = False
next_run = 0 next_run = 0
next_run_path = None next_run_path = None
restore_point = None restore_point = None
@ -30,15 +30,13 @@ class BackupScheduler:
nr = 0 nr = 0
if(xbmcvfs.exists(self.next_run_path)): if(xbmcvfs.exists(self.next_run_path)):
fh = xbmcvfs.File(self.next_run_path) with xbmcvfs.File(self.next_run_path) as fh:
try: try:
# check if we saved a run time from the last run # check if we saved a run time from the last run
nr = float(fh.read()) nr = float(fh.read())
except ValueError: except ValueError:
nr = 0 nr = 0
fh.close()
# if we missed and the user wants to play catch-up # if we missed and the user wants to play catch-up
if(0 < nr <= time.time() and utils.getSettingBool('schedule_miss')): if(0 < nr <= time.time() and utils.getSettingBool('schedule_miss')):
utils.log("scheduled backup was missed, doing it now...") utils.log("scheduled backup was missed, doing it now...")