change exclude criteria. Regex was not matching in complex cases

This commit is contained in:
Rob Weber 2019-08-22 14:42:41 -05:00
parent 9f1755686c
commit d18ed2960e

View File

@ -10,6 +10,7 @@ from vfs import XBMCFileSystem,DropboxFileSystem,ZipFileSystem,GoogleDriveFilesy
from progressbar import BackupProgressBar from progressbar import BackupProgressBar
from resources.lib.guisettings import GuiSettingsManager from resources.lib.guisettings import GuiSettingsManager
from resources.lib.extractor import ZipExtractor from resources.lib.extractor import ZipExtractor
from __builtin__ import file
def folderSort(aKey): def folderSort(aKey):
result = aKey[0] result = aKey[0]
@ -560,10 +561,7 @@ class FileManager:
file_ext = aDir.split('.')[-1] file_ext = aDir.split('.')[-1]
#check if directory is excluded #check if directory is excluded
regex = re.compile(".*(" + aDir + ").*") if(not any(dirPath.startswith(exDir) for exDir in self.exclude_dir)):
excludedCheck = [m.group(0) for l in self.exclude_dir for m in [regex.search(l)] if m]
if(len(excludedCheck) == 0):
self.addFile("-" + dirPath) self.addFile("-" + dirPath)
@ -604,6 +602,10 @@ class FileManager:
except UnicodeDecodeError: except UnicodeDecodeError:
filename = filename.decode('ISO-8859-2') filename = filename.decode('ISO-8859-2')
#remove trailing slash
if(filename[-1] == '/' or filename[-1] == '\\'):
filename = filename[:-1]
#write the full remote path name of this file #write the full remote path name of this file
utils.log("Exclude File: " + filename) utils.log("Exclude File: " + filename)
self.exclude_dir.append(filename) self.exclude_dir.append(filename)