mirror of
https://github.com/robweber/xbmcbackup.git
synced 2024-11-14 20:35:48 +01:00
added options for background progress bar. part of #36
This commit is contained in:
parent
163124089b
commit
987d90de12
@ -14,7 +14,7 @@
|
|||||||
<string id="30019">Type Path</string>
|
<string id="30019">Type Path</string>
|
||||||
<string id="30020">Browse Remote Path</string>
|
<string id="30020">Browse Remote Path</string>
|
||||||
<string id="30021">Backup Folder Name</string>
|
<string id="30021">Backup Folder Name</string>
|
||||||
<string id="30022">Run Silent</string>
|
<string id="30022">Progress Display</string>
|
||||||
<string id="30023">Mode</string>
|
<string id="30023">Mode</string>
|
||||||
<string id="30024">Type Remote Path</string>
|
<string id="30024">Type Remote Path</string>
|
||||||
<string id="30025">Remote Path Type</string>
|
<string id="30025">Remote Path Type</string>
|
||||||
@ -73,4 +73,7 @@
|
|||||||
<string id="30079">Just Today</string>
|
<string id="30079">Just Today</string>
|
||||||
<string id="30080">Profiles</string>
|
<string id="30080">Profiles</string>
|
||||||
<string id="30081">Scheduler will run again on</string>
|
<string id="30081">Scheduler will run again on</string>
|
||||||
|
<string id="30082">Progress Bar</string>
|
||||||
|
<string id="30083">Background Progress Bar</string>
|
||||||
|
<string id="30084">None (Silent)</string>
|
||||||
</strings>
|
</strings>
|
||||||
|
@ -70,7 +70,7 @@ class XbmcBackup:
|
|||||||
def skipAdvanced(self):
|
def skipAdvanced(self):
|
||||||
self.skip_advanced = True
|
self.skip_advanced = True
|
||||||
|
|
||||||
def run(self,mode=-1,runSilent=False):
|
def run(self,mode=-1,progressOverride=False):
|
||||||
#append backup folder name
|
#append backup folder name
|
||||||
progressBarTitle = utils.getString(30010) + " - "
|
progressBarTitle = utils.getString(30010) + " - "
|
||||||
if(mode == self.Backup and self.remote_vfs.root_path != ''):
|
if(mode == self.Backup and self.remote_vfs.root_path != ''):
|
||||||
@ -88,8 +88,13 @@ class XbmcBackup:
|
|||||||
utils.log(utils.getString(30048) + ": " + self.remote_vfs.root_path)
|
utils.log(utils.getString(30048) + ": " + self.remote_vfs.root_path)
|
||||||
|
|
||||||
#check if we should use the progress bar
|
#check if we should use the progress bar
|
||||||
if(utils.getSetting('run_silent') == 'false' and not runSilent):
|
if(int(utils.getSetting('progress_mode')) != 2):
|
||||||
self.progressBar = xbmcgui.DialogProgress()
|
#check if background or normal
|
||||||
|
if(int(utils.getSetting('progress_mode')) == 0 and not progressOverride):
|
||||||
|
self.progressBar = xbmcgui.DialogProgress()
|
||||||
|
else:
|
||||||
|
self.progressBar = xbmcgui.DialogProgressBG()
|
||||||
|
|
||||||
self.progressBar.create(progressBarTitle,utils.getString(30049) + "......")
|
self.progressBar.create(progressBarTitle,utils.getString(30049) + "......")
|
||||||
|
|
||||||
if(mode == self.Backup):
|
if(mode == self.Backup):
|
||||||
@ -296,7 +301,7 @@ class XbmcBackup:
|
|||||||
#call update addons to refresh everything
|
#call update addons to refresh everything
|
||||||
xbmc.executebuiltin('UpdateLocalAddons')
|
xbmc.executebuiltin('UpdateLocalAddons')
|
||||||
|
|
||||||
if(utils.getSetting('run_silent') == 'false' and not runSilent):
|
if(self.progressBar != None):
|
||||||
self.progressBar.close()
|
self.progressBar.close()
|
||||||
|
|
||||||
def backupFiles(self,fileList,source,dest):
|
def backupFiles(self,fileList,source,dest):
|
||||||
@ -342,7 +347,7 @@ class XbmcBackup:
|
|||||||
def _checkCancel(self):
|
def _checkCancel(self):
|
||||||
result = False
|
result = False
|
||||||
|
|
||||||
if(self.progressBar != None):
|
if(self.progressBar != None and type(self.progressBar) is xbmcgui.DialogProgress):
|
||||||
result = self.progressBar.iscanceled()
|
result = self.progressBar.iscanceled()
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<setting id="dropbox_key" type="text" label="30028" visible="eq(-3,2)" default="" />
|
<setting id="dropbox_key" type="text" label="30028" visible="eq(-3,2)" default="" />
|
||||||
<setting id="dropbox_secret" type="text" label="30029" visible="eq(-4,2)" default="" />
|
<setting id="dropbox_secret" type="text" label="30029" visible="eq(-4,2)" default="" />
|
||||||
<setting id="backup_rotation" type="number" label="30026" default="0" />
|
<setting id="backup_rotation" type="number" label="30026" default="0" />
|
||||||
<setting id="run_silent" type="bool" label="30022" default="false" />
|
<setting id="progress_mode" type="enum" label="30022" lvalues="30082|30083|30084" default="0" />
|
||||||
</category>
|
</category>
|
||||||
<category id="selection" label="30012">
|
<category id="selection" label="30012">
|
||||||
<setting id="backup_addons" type="bool" label="30030" default="true" />
|
<setting id="backup_addons" type="bool" label="30030" default="true" />
|
||||||
|
11
scheduler.py
11
scheduler.py
@ -46,13 +46,18 @@ class BackupScheduler:
|
|||||||
now = time.time()
|
now = time.time()
|
||||||
|
|
||||||
if(self.next_run <= now):
|
if(self.next_run <= now):
|
||||||
if(utils.getSetting('run_silent') == 'false'):
|
progress_mode = int(utils.getSetting('progress_mode'))
|
||||||
|
if(progress_mode != 2):
|
||||||
utils.showNotification(utils.getString(30053))
|
utils.showNotification(utils.getString(30053))
|
||||||
#run the job in backup mode, hiding the dialog box
|
|
||||||
backup = XbmcBackup()
|
backup = XbmcBackup()
|
||||||
|
|
||||||
if(backup.remoteConfigured()):
|
if(backup.remoteConfigured()):
|
||||||
backup.run(XbmcBackup.Backup,True)
|
|
||||||
|
if(int(utils.getSetting('progress_mode')) in [0,1]):
|
||||||
|
backup.run(XbmcBackup.Backup,True)
|
||||||
|
else:
|
||||||
|
backup.run(XbmcBackup.Backup,False)
|
||||||
|
|
||||||
#check if this is a "one-off"
|
#check if this is a "one-off"
|
||||||
if(int(utils.getSetting("schedule_interval")) == 0):
|
if(int(utils.getSetting("schedule_interval")) == 0):
|
||||||
|
Loading…
Reference in New Issue
Block a user