mirror of
https://github.com/robweber/xbmcbackup.git
synced 2024-12-22 14:05:23 +01:00
added dict key to designate files instead of '-' sign
This commit is contained in:
parent
76a6aa3bca
commit
780f0f8401
@ -414,9 +414,9 @@ class XbmcBackup:
|
|||||||
if(utils.getSettingBool('verbose_logging')):
|
if(utils.getSettingBool('verbose_logging')):
|
||||||
utils.log('Writing file: ' + aFile['file'])
|
utils.log('Writing file: ' + aFile['file'])
|
||||||
|
|
||||||
if(aFile['file'].startswith("-")):
|
if(aFile['is_dir']):
|
||||||
self._updateProgress('%s remaining\nwriting %s' % (utils.diskString(self.transferLeft), os.path.basename(aFile['file'][len(source.root_path):]) + "/"))
|
self._updateProgress('%s remaining\nwriting %s' % (utils.diskString(self.transferLeft), os.path.basename(aFile['file'][len(source.root_path):]) + "/"))
|
||||||
dest.mkdir(dest.root_path + aFile['file'][len(source.root_path) + 1:])
|
dest.mkdir(dest.root_path + aFile['file'][len(source.root_path):])
|
||||||
else:
|
else:
|
||||||
self._updateProgress('%s remaining\nwriting %s' % (utils.diskString(self.transferLeft), os.path.basename(aFile['file'][len(source.root_path):])))
|
self._updateProgress('%s remaining\nwriting %s' % (utils.diskString(self.transferLeft), os.path.basename(aFile['file'][len(source.root_path):])))
|
||||||
self.transferLeft = self.transferLeft - aFile['size']
|
self.transferLeft = self.transferLeft - aFile['size']
|
||||||
@ -426,6 +426,7 @@ class XbmcBackup:
|
|||||||
|
|
||||||
# if result is still true but this file failed
|
# if result is still true but this file failed
|
||||||
if(not wroteFile and result):
|
if(not wroteFile and result):
|
||||||
|
utils.log("Failed to write " + aFile['file'])
|
||||||
result = False
|
result = False
|
||||||
|
|
||||||
return result
|
return result
|
||||||
@ -583,7 +584,7 @@ class FileManager:
|
|||||||
def walk(self):
|
def walk(self):
|
||||||
|
|
||||||
for aDir in self.root_dirs:
|
for aDir in self.root_dirs:
|
||||||
self.addFile('-' + xbmcvfs.translatePath(aDir['path']))
|
self.addFile(xbmcvfs.translatePath(aDir['path']), True)
|
||||||
self.walkTree(xbmcvfs.translatePath(aDir['path']), aDir['recurse'])
|
self.walkTree(xbmcvfs.translatePath(aDir['path']), aDir['recurse'])
|
||||||
|
|
||||||
def walkTree(self, directory, recurse=True):
|
def walkTree(self, directory, recurse=True):
|
||||||
@ -605,7 +606,7 @@ class FileManager:
|
|||||||
# check if directory is excluded
|
# check if directory is excluded
|
||||||
if(not any(dirPath.startswith(exDir) for exDir in self.exclude_dir)):
|
if(not any(dirPath.startswith(exDir) for exDir in self.exclude_dir)):
|
||||||
|
|
||||||
self.addFile("-" + dirPath)
|
self.addFile(dirPath, True)
|
||||||
|
|
||||||
# catch for "non directory" type files
|
# catch for "non directory" type files
|
||||||
shouldWalk = True
|
shouldWalk = True
|
||||||
@ -628,7 +629,7 @@ class FileManager:
|
|||||||
else:
|
else:
|
||||||
self.excludeFile(xbmcvfs.translatePath(dirMeta['path']))
|
self.excludeFile(xbmcvfs.translatePath(dirMeta['path']))
|
||||||
|
|
||||||
def addFile(self, filename):
|
def addFile(self, filename, is_dir = False):
|
||||||
# write the full remote path name of this file
|
# write the full remote path name of this file
|
||||||
if(utils.getSettingBool('verbose_logging')):
|
if(utils.getSettingBool('verbose_logging')):
|
||||||
utils.log("Add File: " + filename)
|
utils.log("Add File: " + filename)
|
||||||
@ -637,7 +638,7 @@ class FileManager:
|
|||||||
fSize = self.vfs.fileSize(filename)
|
fSize = self.vfs.fileSize(filename)
|
||||||
self.totalSize = self.totalSize + fSize
|
self.totalSize = self.totalSize + fSize
|
||||||
|
|
||||||
self.fileArray.append({'file': filename, 'size': fSize})
|
self.fileArray.append({'file': filename, 'size': fSize, 'is_dir': is_dir})
|
||||||
|
|
||||||
def excludeFile(self, filename):
|
def excludeFile(self, filename):
|
||||||
# remove trailing slash
|
# remove trailing slash
|
||||||
|
Loading…
Reference in New Issue
Block a user