mirror of
https://github.com/robweber/xbmcbackup.git
synced 2024-11-15 04:45:49 +01:00
can restore full file tree
This commit is contained in:
parent
c28f9fd26b
commit
9a89066e66
@ -270,15 +270,18 @@ class XbmcBackup:
|
|||||||
else:
|
else:
|
||||||
utils.log("zip file exists already")
|
utils.log("zip file exists already")
|
||||||
|
|
||||||
#set the new remote vfs
|
#extract the zip file
|
||||||
self.remote_vfs = ZipFileSystem(xbmc.translatePath(utils.data_dir() + self.restore_point),'r')
|
zip_vfs = ZipFileSystem(xbmc.translatePath(utils.data_dir() + self.restore_point),'r')
|
||||||
self.remote_vfs.set_root(self.restore_point.split(".")[0] + "/")
|
zip_vfs.extract(xbmc.translatePath(utils.data_dir()))
|
||||||
|
|
||||||
else:
|
#set the new remote vfs
|
||||||
#for restores remote path must exist
|
self.remote_vfs = XBMCFileSystem(xbmc.translatePath(utils.data_dir() + self.restore_point.split(".")[0] + "/"))
|
||||||
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)):
|
if(not self._checkValidationFile(self.remote_vfs.root_path)):
|
||||||
#don't continue
|
#don't continue
|
||||||
|
@ -82,25 +82,29 @@ class ZipFileSystem(Vfs):
|
|||||||
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 [[],[]]
|
||||||
|
|
||||||
def mkdir(self,directory):
|
def mkdir(self,directory):
|
||||||
#self.zip.write(directory[len(self.root_path):])
|
#self.zip.write(directory[len(self.root_path):])
|
||||||
return True
|
return False
|
||||||
|
|
||||||
def put(self,source,dest):
|
def put(self,source,dest):
|
||||||
self.zip.write(source,dest,compress_type=zipfile.ZIP_DEFLATED)
|
self.zip.write(source,dest,compress_type=zipfile.ZIP_DEFLATED)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def rmdir(self,directory):
|
def rmdir(self,directory):
|
||||||
return True
|
return False
|
||||||
|
|
||||||
def exists(self,aFile):
|
def exists(self,aFile):
|
||||||
return True
|
return False
|
||||||
|
|
||||||
def cleanup(self):
|
def cleanup(self):
|
||||||
self.zip.close()
|
self.zip.close()
|
||||||
|
|
||||||
|
def extract(self,path):
|
||||||
|
#extract zip file to path
|
||||||
|
self.zip.extractall(path)
|
||||||
|
|
||||||
class DropboxFileSystem(Vfs):
|
class DropboxFileSystem(Vfs):
|
||||||
client = None
|
client = None
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user