mirror of
				https://github.com/robweber/xbmcbackup.git
				synced 2025-11-04 03:02:16 +01: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"?>
 | 
					<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 | 
				
			||||||
<addon id="script.xbmcbackup"
 | 
					<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>
 | 
					  <requires>
 | 
				
			||||||
    <import addon="xbmc.python" version="2.0"/>
 | 
					    <import addon="xbmc.python" version="2.0"/>
 | 
				
			||||||
  </requires>
 | 
					  </requires>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,3 +1,7 @@
 | 
				
			|||||||
 | 
					Version 0.1.9
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					added GUI changes to emulate Frodo look
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Version 0.1.8
 | 
					Version 0.1.8
 | 
				
			||||||
 | 
					
 | 
				
			||||||
moved eden to new branch, frodo is now master
 | 
					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
 | 
					from resources.lib.backup import XbmcBackup
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#run the profile backup
 | 
					#figure out if this is a backup or a restore
 | 
				
			||||||
backup = XbmcBackup()
 | 
					mode = xbmcgui.Dialog().select(utils.getString(30010) + " - " + utils.getString(30023),[utils.getString(30016),utils.getString(30017)])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if(backup.isReady()):
 | 
					if(mode != -1):
 | 
				
			||||||
    backup.run()
 | 
					    #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
 | 
					    filesTotal = 1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    fileManager = None
 | 
					    fileManager = None
 | 
				
			||||||
 | 
					    restore_point = None
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    def __init__(self):
 | 
					    def __init__(self):
 | 
				
			||||||
        self.local_path = xbmc.makeLegalFilename(xbmc.translatePath("special://home"),False);
 | 
					        self.local_path = xbmc.makeLegalFilename(xbmc.translatePath("special://home"),False);
 | 
				
			||||||
@@ -106,27 +107,43 @@ class XbmcBackup:
 | 
				
			|||||||
        
 | 
					        
 | 
				
			||||||
        utils.log(utils.getString(30046))
 | 
					        utils.log(utils.getString(30046))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def run(self,mode=-1,runSilent=False):
 | 
					    def listBackups(self):
 | 
				
			||||||
	#check if we should use the progress bar
 | 
					        result = list()
 | 
				
			||||||
        if(utils.getSetting('run_silent') == 'false' and not runSilent):
 | 
					 | 
				
			||||||
            self.progressBar = xbmcgui.DialogProgress()
 | 
					 | 
				
			||||||
            self.progressBar.create(utils.getString(30010),utils.getString(30049) + "......")
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        #determine backup mode
 | 
					        #get all the folders in the current root path
 | 
				
			||||||
        if(mode == -1):
 | 
					        dirs = vfs.listdir(self.remote_path)
 | 
				
			||||||
            mode = int(utils.getSetting('addon_mode'))
 | 
					        
 | 
				
			||||||
 | 
					        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
 | 
					        #append backup folder name
 | 
				
			||||||
 | 
					        progressBarTitle = utils.getString(30010) + " - "
 | 
				
			||||||
        if(mode == self.Backup and self.remote_path != ''):
 | 
					        if(mode == self.Backup and self.remote_path != ''):
 | 
				
			||||||
            self.remote_path = self.remote_path + time.strftime("%Y%m%d") + "/"
 | 
					            self.remote_path = self.remote_path + time.strftime("%Y%m%d") + "/"
 | 
				
			||||||
	elif(mode == self.Restore and utils.getSetting("backup_name") != '' and self.remote_path != ''):
 | 
					            progressBarTitle = progressBarTitle + utils.getString(30016)
 | 
				
			||||||
	    self.remote_path = self.remote_path + utils.getSetting("backup_name") + "/"
 | 
						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:
 | 
						else:
 | 
				
			||||||
 | 
					            #kill the program here
 | 
				
			||||||
	    self.remote_path = ""
 | 
						    self.remote_path = ""
 | 
				
			||||||
 | 
						    return
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        utils.log(utils.getString(30047) + ": " + self.local_path)
 | 
					        utils.log(utils.getString(30047) + ": " + self.local_path)
 | 
				
			||||||
        utils.log(utils.getString(30048) + ": " + self.remote_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
 | 
					        #run the correct mode
 | 
				
			||||||
        if(mode == self.Backup):
 | 
					        if(mode == self.Backup):
 | 
				
			||||||
            utils.log(utils.getString(30023) + " - " + utils.getString(30016))
 | 
					            utils.log(utils.getString(30023) + " - " + utils.getString(30016))
 | 
				
			||||||
@@ -206,5 +223,3 @@ class XbmcBackup:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        return result
 | 
					        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"?>
 | 
					<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 | 
				
			||||||
<settings>
 | 
					<settings>
 | 
				
			||||||
	<category id="general" label="30011">
 | 
						<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_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_2" type="text" label="30024" default="" visible="eq(-1,1)" />
 | 
				
			||||||
		<setting id="remote_path" type="folder" label="30020" visible="eq(-2,0)" />
 | 
							<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" />
 | 
							<setting id="run_silent" type="bool" label="30022" default="false" />
 | 
				
			||||||
	</category>
 | 
						</category>
 | 
				
			||||||
	<category id="selection" label="30012">
 | 
						<category id="selection" label="30012">
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user