support for quitting xbmc after scheduled backup

This commit is contained in:
Rob Weber 2012-12-13 15:11:25 -06:00
parent 46cd3c6731
commit e40e6c685d
3 changed files with 11 additions and 1 deletions

View File

@ -54,4 +54,5 @@
<string id="30073">Every Week</string> <string id="30073">Every Week</string>
<string id="30074">First Day of Month</string> <string id="30074">First Day of Month</string>
<string id="30075">Custom Schedule</string> <string id="30075">Custom Schedule</string>
<string id="30076">Shutdown After Backup</string>
</strings> </strings>

View File

@ -21,5 +21,6 @@
<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="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="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)"/> <setting id="cron_schedule" type="text" label="30064" default="0 0 * * *" visible="eq(-3,3)" enable="eq(-4,true)"/>
<setting id="cron_shutdown" type="bool" label="30076" default="false" enable="eq(-5,true)" />
</category> </category>
</settings> </settings>

View File

@ -44,6 +44,14 @@ class BackupScheduler:
#run the job in backup mode, hiding the dialog box #run the job in backup mode, hiding the dialog box
backup = XbmcBackup() backup = XbmcBackup()
backup.run(XbmcBackup.Backup,True) backup.run(XbmcBackup.Backup,True)
#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
time.sleep(10)
xbmc.executebuiltin('Quit()')
else:
#find the next run time like normal
self.findNextRun(now,True) self.findNextRun(now,True)
else: else:
self.findNextRun(now) self.findNextRun(now)