mirror of
https://github.com/robweber/xbmcbackup.git
synced 2024-11-15 04:45:49 +01:00
copy zip file and open in write mode
This commit is contained in:
parent
c49aebeba1
commit
933fdbdf09
@ -117,7 +117,7 @@ class XbmcBackup:
|
|||||||
if(utils.getSetting("compress_backups") == 'true'):
|
if(utils.getSetting("compress_backups") == 'true'):
|
||||||
#save the remote file system and use the zip vfs
|
#save the remote file system and use the zip vfs
|
||||||
self.saved_remote_vfs = self.remote_vfs
|
self.saved_remote_vfs = self.remote_vfs
|
||||||
self.remote_vfs = ZipFileSystem("","w")
|
self.remote_vfs = ZipFileSystem(xbmc.translatePath(utils.data_dir() + "xbmc_backup_temp.zip"),"w")
|
||||||
|
|
||||||
self.remote_vfs.set_root(self.remote_vfs.root_path + time.strftime("%Y%m%d%H%M") + "/")
|
self.remote_vfs.set_root(self.remote_vfs.root_path + time.strftime("%Y%m%d%H%M") + "/")
|
||||||
progressBarTitle = progressBarTitle + utils.getString(30016)
|
progressBarTitle = progressBarTitle + utils.getString(30016)
|
||||||
@ -256,12 +256,22 @@ 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
|
#copy just this file from the remote vfs
|
||||||
pass
|
zipFile = []
|
||||||
|
zipFile.append(self.restore_point)
|
||||||
|
|
||||||
|
#set root to data dir home
|
||||||
|
self.xbmc_vfs.set_root(xbmc.translatePath(utils.data_dir()))
|
||||||
|
|
||||||
|
self.progressBar.updateProgress(0, "Copying Zip Archive")
|
||||||
|
self.backupFiles(zipFile,self.remote_vfs, self.xbmc_vfs)
|
||||||
|
|
||||||
#for restores remote path must exist
|
#set the new remote vfs
|
||||||
if(not self.remote_vfs.exists(self.remote_vfs.root_path)):
|
self.remote_vfs = ZipFileSystem(xbmc.translatePath(utils.data_dir() + self.restore_point),'r')
|
||||||
xbmcgui.Dialog().ok(utils.getString(30010),utils.getString(30045),self.remote_vfs.root_path)
|
else:
|
||||||
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)):
|
if(not self._checkValidationFile(self.remote_vfs.root_path)):
|
||||||
#don't continue
|
#don't continue
|
||||||
|
@ -18,7 +18,7 @@ class Vfs:
|
|||||||
def set_root(self,rootString):
|
def set_root(self,rootString):
|
||||||
old_root = self.root_path
|
old_root = self.root_path
|
||||||
self.root_path = rootString
|
self.root_path = rootString
|
||||||
|
|
||||||
#fix slashes
|
#fix slashes
|
||||||
self.root_path = self.root_path.replace("\\","/")
|
self.root_path = self.root_path.replace("\\","/")
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ class ZipFileSystem(Vfs):
|
|||||||
|
|
||||||
def __init__(self,rootString,mode):
|
def __init__(self,rootString,mode):
|
||||||
self.root_path = ""
|
self.root_path = ""
|
||||||
self.zip = zipfile.ZipFile(xbmc.translatePath(utils.data_dir() + "xbmc_backup_temp.zip"),mode=mode)
|
self.zip = zipfile.ZipFile(rootString,mode=mode)
|
||||||
|
|
||||||
|
|
||||||
def listdir(self,directory):
|
def listdir(self,directory):
|
||||||
|
Loading…
Reference in New Issue
Block a user