diff --git a/resources/lib/backup.py b/resources/lib/backup.py index cee7ebb..a495537 100644 --- a/resources/lib/backup.py +++ b/resources/lib/backup.py @@ -270,15 +270,18 @@ class XbmcBackup: else: utils.log("zip file exists already") + #extract the zip file + zip_vfs = ZipFileSystem(xbmc.translatePath(utils.data_dir() + self.restore_point),'r') + zip_vfs.extract(xbmc.translatePath(utils.data_dir())) + #set the new remote vfs - self.remote_vfs = ZipFileSystem(xbmc.translatePath(utils.data_dir() + self.restore_point),'r') - self.remote_vfs.set_root(self.restore_point.split(".")[0] + "/") + self.remote_vfs = XBMCFileSystem(xbmc.translatePath(utils.data_dir() + self.restore_point.split(".")[0] + "/")) - else: - #for restores remote path must exist - if(not self.remote_vfs.exists(self.remote_vfs.root_path)): - xbmcgui.Dialog().ok(utils.getString(30010),utils.getString(30045),self.remote_vfs.root_path) - return + + #for restores remote path must exist + if(not self.remote_vfs.exists(self.remote_vfs.root_path)): + xbmcgui.Dialog().ok(utils.getString(30010),utils.getString(30045),self.remote_vfs.root_path) + return if(not self._checkValidationFile(self.remote_vfs.root_path)): #don't continue diff --git a/resources/lib/vfs.py b/resources/lib/vfs.py index af49852..ddb4da4 100644 --- a/resources/lib/vfs.py +++ b/resources/lib/vfs.py @@ -82,24 +82,28 @@ class ZipFileSystem(Vfs): self.zip = zipfile.ZipFile(rootString,mode=mode) def listdir(self,directory): - return True + return [[],[]] def mkdir(self,directory): #self.zip.write(directory[len(self.root_path):]) - return True + return False def put(self,source,dest): self.zip.write(source,dest,compress_type=zipfile.ZIP_DEFLATED) return True def rmdir(self,directory): - return True + return False def exists(self,aFile): - return True + return False def cleanup(self): self.zip.close() + + def extract(self,path): + #extract zip file to path + self.zip.extractall(path) class DropboxFileSystem(Vfs): client = None