mirror of
https://github.com/robweber/xbmcbackup.git
synced 2025-06-22 02:33:41 +02:00
added gui changes to be similar to Frodo branch
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<addon id="script.xbmcbackup"
|
||||
name="XBMC Backup" version="0.1.8" provider-name="robweber">
|
||||
name="XBMC Backup" version="0.1.9" provider-name="robweber">
|
||||
<requires>
|
||||
<import addon="xbmc.python" version="2.0"/>
|
||||
</requires>
|
||||
|
@ -1,3 +1,7 @@
|
||||
Version 0.1.9
|
||||
|
||||
added GUI changes to emulate Frodo look
|
||||
|
||||
Version 0.1.8
|
||||
|
||||
moved eden to new branch, frodo is now master
|
||||
|
22
default.py
22
default.py
@ -1,7 +1,21 @@
|
||||
import xbmcgui
|
||||
import resources.lib.utils as utils
|
||||
from resources.lib.backup import XbmcBackup
|
||||
|
||||
#run the profile backup
|
||||
backup = XbmcBackup()
|
||||
#figure out if this is a backup or a restore
|
||||
mode = xbmcgui.Dialog().select(utils.getString(30010) + " - " + utils.getString(30023),[utils.getString(30016),utils.getString(30017)])
|
||||
|
||||
if(backup.isReady()):
|
||||
backup.run()
|
||||
if(mode != -1):
|
||||
#run the profile backup
|
||||
backup = XbmcBackup()
|
||||
|
||||
if(mode == backup.Restore):
|
||||
#allow user to select the backup to restore from
|
||||
restorePoints = backup.listBackups()
|
||||
|
||||
selectedRestore = xbmcgui.Dialog().select(utils.getString(30010) + " - " + utils.getString(30021),restorePoints)
|
||||
|
||||
if(selectedRestore != -1):
|
||||
backup.selectRestore(restorePoints[selectedRestore])
|
||||
|
||||
backup.run(mode)
|
||||
|
2
resources/.gitignore
vendored
Normal file
2
resources/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
|
||||
*.pyo
|
@ -87,6 +87,7 @@ class XbmcBackup:
|
||||
filesTotal = 1
|
||||
|
||||
fileManager = None
|
||||
restore_point = None
|
||||
|
||||
def __init__(self):
|
||||
self.local_path = xbmc.makeLegalFilename(xbmc.translatePath("special://home"),False);
|
||||
@ -106,27 +107,43 @@ class XbmcBackup:
|
||||
|
||||
utils.log(utils.getString(30046))
|
||||
|
||||
def run(self,mode=-1,runSilent=False):
|
||||
#check if we should use the progress bar
|
||||
if(utils.getSetting('run_silent') == 'false' and not runSilent):
|
||||
self.progressBar = xbmcgui.DialogProgress()
|
||||
self.progressBar.create(utils.getString(30010),utils.getString(30049) + "......")
|
||||
def listBackups(self):
|
||||
result = list()
|
||||
|
||||
#determine backup mode
|
||||
if(mode == -1):
|
||||
mode = int(utils.getSetting('addon_mode'))
|
||||
#get all the folders in the current root path
|
||||
dirs = vfs.listdir(self.remote_path)
|
||||
|
||||
for aDir in dirs:
|
||||
result.append(aDir[len(self.remote_path):-1])
|
||||
|
||||
return result
|
||||
|
||||
def selectRestore(self,restore_point):
|
||||
self.restore_point = restore_point
|
||||
|
||||
def run(self,mode=-1,runSilent=False):
|
||||
|
||||
#append backup folder name
|
||||
progressBarTitle = utils.getString(30010) + " - "
|
||||
if(mode == self.Backup and self.remote_path != ''):
|
||||
self.remote_path = self.remote_path + time.strftime("%Y%m%d") + "/"
|
||||
elif(mode == self.Restore and utils.getSetting("backup_name") != '' and self.remote_path != ''):
|
||||
self.remote_path = self.remote_path + utils.getSetting("backup_name") + "/"
|
||||
progressBarTitle = progressBarTitle + utils.getString(30016)
|
||||
elif(mode == self.Restore and self.restore_point != None and self.remote_path != ''):
|
||||
self.remote_path = self.remote_path + self.restore_point + "/"
|
||||
progressBarTitle = progressBarTitle + utils.getString(30017)
|
||||
else:
|
||||
#kill the program here
|
||||
self.remote_path = ""
|
||||
return
|
||||
|
||||
utils.log(utils.getString(30047) + ": " + self.local_path)
|
||||
utils.log(utils.getString(30048) + ": " + self.remote_path)
|
||||
|
||||
#check if we should use the progress bar
|
||||
if(utils.getSetting('run_silent') == 'false' and not runSilent):
|
||||
self.progressBar = xbmcgui.DialogProgress()
|
||||
self.progressBar.create(progressBarTitle,utils.getString(30049) + "......")
|
||||
|
||||
#run the correct mode
|
||||
if(mode == self.Backup):
|
||||
utils.log(utils.getString(30023) + " - " + utils.getString(30016))
|
||||
@ -206,5 +223,3 @@ class XbmcBackup:
|
||||
|
||||
return result
|
||||
|
||||
def isReady(self):
|
||||
return True if self.remote_path != '' else False
|
||||
|
@ -1,11 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<settings>
|
||||
<category id="general" label="30011">
|
||||
<setting id="addon_mode" type="enum" lvalues="30016|30017" default="0" label="30023" />
|
||||
<setting id="remote_selection" type="enum" lvalues="30018|30019" default="0" label="30025"/>
|
||||
<setting id="remote_path_2" type="text" label="30024" default="" visible="eq(-1,1)" />
|
||||
<setting id="remote_path" type="folder" label="30020" visible="eq(-2,0)" />
|
||||
<setting id="backup_name" type="text" label="30021" default="backup_date" visible="eq(-4,1)"/>
|
||||
<setting id="run_silent" type="bool" label="30022" default="false" />
|
||||
</category>
|
||||
<category id="selection" label="30012">
|
||||
|
Reference in New Issue
Block a user