will copy zip file from remote to dest

This commit is contained in:
Rob Weber 2014-08-01 12:37:57 -05:00
parent 933fdbdf09
commit c28f9fd26b
2 changed files with 15 additions and 8 deletions

View File

@ -255,18 +255,25 @@ class XbmcBackup:
#catch for if the restore point is actually a zip file #catch for if the restore point is actually a zip file
if(self.restore_point.split('.')[-1] == 'zip'): if(self.restore_point.split('.')[-1] == 'zip'):
#copy just this file from the remote vfs self.progressBar.updateProgress(0, "Copying Zip Archive")
zipFile = [] utils.log("copying zip file: " + self.restore_point)
zipFile.append(self.restore_point)
#set root to data dir home #set root to data dir home
self.xbmc_vfs.set_root(xbmc.translatePath(utils.data_dir())) self.xbmc_vfs.set_root(xbmc.translatePath(utils.data_dir()))
self.progressBar.updateProgress(0, "Copying Zip Archive") if(not self.xbmc_vfs.exists(xbmc.translatePath(utils.data_dir() + self.restore_point))):
self.backupFiles(zipFile,self.remote_vfs, self.xbmc_vfs) #copy just this file from the remote vfs
zipFile = []
zipFile.append(self.remote_base_path + self.restore_point)
self.backupFiles(zipFile,self.remote_vfs, self.xbmc_vfs)
else:
utils.log("zip file exists already")
#set the new remote vfs #set the new remote vfs
self.remote_vfs = ZipFileSystem(xbmc.translatePath(utils.data_dir() + self.restore_point),'r') self.remote_vfs = ZipFileSystem(xbmc.translatePath(utils.data_dir() + self.restore_point),'r')
self.remote_vfs.set_root(self.restore_point.split(".")[0] + "/")
else: else:
#for restores remote path must exist #for restores remote path must exist
if(not self.remote_vfs.exists(self.remote_vfs.root_path)): if(not self.remote_vfs.exists(self.remote_vfs.root_path)):

View File

@ -62,6 +62,7 @@ class XBMCFileSystem(Vfs):
return xbmcvfs.mkdir(directory) return xbmcvfs.mkdir(directory)
def put(self,source,dest): def put(self,source,dest):
utils.log(source + ":" + dest)
return xbmcvfs.copy(source,dest) return xbmcvfs.copy(source,dest)
def rmdir(self,directory): def rmdir(self,directory):
@ -80,7 +81,6 @@ class ZipFileSystem(Vfs):
self.root_path = "" self.root_path = ""
self.zip = zipfile.ZipFile(rootString,mode=mode) self.zip = zipfile.ZipFile(rootString,mode=mode)
def listdir(self,directory): def listdir(self,directory):
return True return True