From f028bffca49cded9173de6b55a9a284f4ced6a56 Mon Sep 17 00:00:00 2001 From: Rob Weber Date: Sun, 25 Aug 2013 10:58:23 -0500 Subject: [PATCH] added setting for 'one-off' schedules --- addon.xml | 2 +- changelog.txt | 4 ++++ resources/language/English/strings.xml | 1 + resources/settings.xml | 2 +- scheduler.py | 13 ++++++++++--- 5 files changed, 17 insertions(+), 5 deletions(-) diff --git a/addon.xml b/addon.xml index bd4ff2b..52bf749 100644 --- a/addon.xml +++ b/addon.xml @@ -1,6 +1,6 @@  + name="XBMC Backup" version="0.3.9" provider-name="robweber"> diff --git a/changelog.txt b/changelog.txt index e2e7705..47cb869 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,7 @@ +Version 0.3.9 + +added "just today" scheduler for one-off type backups + Version 0.3.8 added advancedsettings check on restore. prompts user to restore only this file and restart xbmc to continue. This fixes issues where path substitution was not working during restores - thanks ctrlbru diff --git a/resources/language/English/strings.xml b/resources/language/English/strings.xml index 26c9023..1864405 100644 --- a/resources/language/English/strings.xml +++ b/resources/language/English/strings.xml @@ -70,4 +70,5 @@ Shutdown After Backup Restart XBMC You should restart XBMC to continue + Just Today diff --git a/resources/settings.xml b/resources/settings.xml index 5c15bea..00ebbb5 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -23,7 +23,7 @@ - + diff --git a/scheduler.py b/scheduler.py index 23ccb4e..596a272 100644 --- a/scheduler.py +++ b/scheduler.py @@ -52,6 +52,12 @@ class BackupScheduler: backup = XbmcBackup() backup.run(XbmcBackup.Backup,True) + #check if this is a "one-off" + if(int(utils.getSetting("schedule_interval")) == 0): + #disable the scheduler after this run + self.enabled = "false" + utils.setSetting('enable_scheduler','false') + #check if we should shut the computer down if(utils.getSetting("cron_shutdown") == 'true'): #wait 10 seconds to make sure all backup processes and files are completed @@ -72,6 +78,7 @@ class BackupScheduler: if(new_run_time != self.next_run): self.next_run = new_run_time + #utils.showNotification("Scheduler will run again on " + datetime.datetime.fromtimestamp(self.next_run).strftime('%m-%d-%Y %H:%M')") utils.log("scheduler will run again on " + datetime.datetime.fromtimestamp(self.next_run).strftime('%m-%d-%Y %H:%M')) def settingsChanged(self): @@ -95,14 +102,14 @@ class BackupScheduler: hour_of_day = utils.getSetting("schedule_time") hour_of_day = int(hour_of_day[0:2]) - if(schedule_type == 0): + if(schedule_type == 0 or schedule_type == 1): #every day cron_exp = "0 " + str(hour_of_day) + " * * *" - elif(schedule_type == 1): + elif(schedule_type == 2): #once a week day_of_week = utils.getSetting("day_of_week") cron_exp = "0 " + str(hour_of_day) + " * * " + day_of_week - elif(schedule_type == 2): + elif(schedule_type == 3): #first day of month cron_exp = "0 " + str(hour_of_day) + " 1 * *"