mirror of
https://github.com/robweber/xbmcbackup.git
synced 2024-12-22 22:15:23 +01:00
added setting for 'one-off' schedules
This commit is contained in:
parent
3ae5ce8f6f
commit
f028bffca4
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<addon id="script.xbmcbackup"
|
||||
name="XBMC Backup" version="0.3.8" provider-name="robweber">
|
||||
name="XBMC Backup" version="0.3.9" provider-name="robweber">
|
||||
<requires>
|
||||
<import addon="xbmc.python" version="2.1.0"/>
|
||||
</requires>
|
||||
|
@ -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
|
||||
|
@ -70,4 +70,5 @@
|
||||
<string id="30076">Shutdown After Backup</string>
|
||||
<string id="30077">Restart XBMC</string>
|
||||
<string id="30078">You should restart XBMC to continue</string>
|
||||
<string id="30079">Just Today</string>
|
||||
</strings>
|
||||
|
@ -23,7 +23,7 @@
|
||||
</category>
|
||||
<category id="scheduling" label="30013">
|
||||
<setting id="enable_scheduler" type="bool" label="30060" default="false" />
|
||||
<setting id="schedule_interval" type="enum" label="30061" lvalues="30072|30073|30074|30075" default="0" enable="eq(-1,true)"/>
|
||||
<setting id="schedule_interval" type="enum" label="30061" lvalues="30079|30072|30073|30074|30075" default="1" enable="eq(-1,true)"/>
|
||||
<setting id="schedule_time" type="labelenum" label="30062" values="00:00|01:00|02:00|03:00|04:00|05:00|06:00|07:00|08:00|09:00|10:00|11:00|12:00|13:00|14:00|15:00|16:00|17:00|18:00|19:00|20:00|21:00|22:00|23:00" default="00:00" visible="!eq(-1,3)" enable="eq(-2,true)"/>
|
||||
<setting id="day_of_week" type="enum" label="30063" lvalues="30065|30066|30067|30068|30069|30070|30071" default="0" visible="eq(-2,1)" enable="eq(-3,true)"/>
|
||||
<setting id="cron_schedule" type="text" label="30064" default="0 0 * * *" visible="eq(-3,3)" enable="eq(-4,true)"/>
|
||||
|
13
scheduler.py
13
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 * *"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user