mirror of
https://github.com/robweber/xbmcbackup.git
synced 2024-11-14 20:35:48 +01:00
exclude packages dir by default, not needed closes #102
This commit is contained in:
parent
3fcc15ebe5
commit
2c634f9250
@ -178,6 +178,7 @@ class XbmcBackup:
|
|||||||
#go through each of the user selected items and write them to the backup store
|
#go through each of the user selected items and write them to the backup store
|
||||||
if(utils.getSetting('backup_addons') == 'true'):
|
if(utils.getSetting('backup_addons') == 'true'):
|
||||||
fileManager.addFile("-" + xbmc.translatePath('special://home/addons'))
|
fileManager.addFile("-" + xbmc.translatePath('special://home/addons'))
|
||||||
|
fileManager.excludeFile(xbmc.translatePath('special://home/addons/packages'))
|
||||||
fileManager.walkTree(xbmc.translatePath('special://home/addons'))
|
fileManager.walkTree(xbmc.translatePath('special://home/addons'))
|
||||||
|
|
||||||
fileManager.addFile("-" + xbmc.translatePath('special://home/userdata'))
|
fileManager.addFile("-" + xbmc.translatePath('special://home/userdata'))
|
||||||
@ -580,7 +581,8 @@ class XbmcBackup:
|
|||||||
|
|
||||||
class FileManager:
|
class FileManager:
|
||||||
not_dir = ['.zip','.xsp','.rar']
|
not_dir = ['.zip','.xsp','.rar']
|
||||||
|
exclude_dir = []
|
||||||
|
|
||||||
def __init__(self,vfs):
|
def __init__(self,vfs):
|
||||||
self.vfs = vfs
|
self.vfs = vfs
|
||||||
self.fileArray = []
|
self.fileArray = []
|
||||||
@ -595,20 +597,22 @@ class FileManager:
|
|||||||
|
|
||||||
#create all the subdirs first
|
#create all the subdirs first
|
||||||
for aDir in dirs:
|
for aDir in dirs:
|
||||||
dirPath = xbmc.translatePath(directory + "/" + aDir)
|
dirPath = xbmc.validatePath(xbmc.translatePath(directory + "/" + aDir))
|
||||||
file_ext = aDir.split('.')[-1]
|
file_ext = aDir.split('.')[-1]
|
||||||
|
|
||||||
self.addFile("-" + dirPath)
|
|
||||||
|
|
||||||
#catch for "non directory" type files
|
if(not dirPath in self.exclude_dir):
|
||||||
shouldWalk = True
|
|
||||||
|
self.addFile("-" + dirPath)
|
||||||
|
|
||||||
for s in file_ext:
|
#catch for "non directory" type files
|
||||||
if(s in self.not_dir):
|
shouldWalk = True
|
||||||
shouldWalk = False
|
|
||||||
|
for s in file_ext:
|
||||||
|
if(s in self.not_dir):
|
||||||
|
shouldWalk = False
|
||||||
|
|
||||||
if(shouldWalk):
|
if(shouldWalk):
|
||||||
self.walkTree(dirPath)
|
self.walkTree(dirPath)
|
||||||
|
|
||||||
#copy all the files
|
#copy all the files
|
||||||
for aFile in files:
|
for aFile in files:
|
||||||
@ -625,6 +629,16 @@ class FileManager:
|
|||||||
utils.log("Add File: " + filename,xbmc.LOGDEBUG)
|
utils.log("Add File: " + filename,xbmc.LOGDEBUG)
|
||||||
self.fileArray.append(filename)
|
self.fileArray.append(filename)
|
||||||
|
|
||||||
|
def excludeFile(self,filename):
|
||||||
|
try:
|
||||||
|
filename = filename.decode('UTF-8')
|
||||||
|
except UnicodeDecodeError:
|
||||||
|
filename = filename.decode('ISO-8859-2')
|
||||||
|
|
||||||
|
#write the full remote path name of this file
|
||||||
|
utils.log("Exclude File: " + filename,xbmc.LOGDEBUG)
|
||||||
|
self.exclude_dir.append(filename)
|
||||||
|
|
||||||
def getFiles(self):
|
def getFiles(self):
|
||||||
result = self.fileArray
|
result = self.fileArray
|
||||||
self.fileArray = []
|
self.fileArray = []
|
||||||
|
Loading…
Reference in New Issue
Block a user