From c28f9fd26b3018aa57d6742d28b05b7026ed7a96 Mon Sep 17 00:00:00 2001 From: Rob Weber Date: Fri, 1 Aug 2014 12:37:57 -0500 Subject: [PATCH] will copy zip file from remote to dest --- resources/lib/backup.py | 21 ++++++++++++++------- resources/lib/vfs.py | 2 +- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/resources/lib/backup.py b/resources/lib/backup.py index 99af862..cee7ebb 100644 --- a/resources/lib/backup.py +++ b/resources/lib/backup.py @@ -255,18 +255,25 @@ class XbmcBackup: #catch for if the restore point is actually a zip file if(self.restore_point.split('.')[-1] == 'zip'): - #copy just this file from the remote vfs - zipFile = [] - zipFile.append(self.restore_point) - + self.progressBar.updateProgress(0, "Copying Zip Archive") + utils.log("copying zip file: " + self.restore_point) + #set root to data dir home self.xbmc_vfs.set_root(xbmc.translatePath(utils.data_dir())) + + if(not self.xbmc_vfs.exists(xbmc.translatePath(utils.data_dir() + self.restore_point))): + #copy just this file from the remote vfs + zipFile = [] + zipFile.append(self.remote_base_path + self.restore_point) - self.progressBar.updateProgress(0, "Copying Zip Archive") - self.backupFiles(zipFile,self.remote_vfs, self.xbmc_vfs) - + self.backupFiles(zipFile,self.remote_vfs, self.xbmc_vfs) + else: + utils.log("zip file exists already") + #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] + "/") + else: #for restores remote path must exist if(not self.remote_vfs.exists(self.remote_vfs.root_path)): diff --git a/resources/lib/vfs.py b/resources/lib/vfs.py index 99be5bc..af49852 100644 --- a/resources/lib/vfs.py +++ b/resources/lib/vfs.py @@ -62,6 +62,7 @@ class XBMCFileSystem(Vfs): return xbmcvfs.mkdir(directory) def put(self,source,dest): + utils.log(source + ":" + dest) return xbmcvfs.copy(source,dest) def rmdir(self,directory): @@ -80,7 +81,6 @@ class ZipFileSystem(Vfs): self.root_path = "" self.zip = zipfile.ZipFile(rootString,mode=mode) - def listdir(self,directory): return True