This commit is contained in:
kaetemi 2014-07-30 21:47:48 +02:00
parent 1cf184c09d
commit 8d8d340968

View file

@ -369,7 +369,29 @@ def needUpdateDirByTagLogFiltered(log, dir_source, ext_source, dir_dest, ext_des
return 0 return 0
def needUpdateDirByTagLog(log, dir_source, ext_source, dir_dest, ext_dest): def needUpdateDirByTagLog(log, dir_source, ext_source, dir_dest, ext_dest):
needUpdateDirByTagLogFiltered(log, dir_source, ext_source, dir_dest, ext_dest, [ ]) updateCount = 0
skipCount = 0
lenSrcExt = len(ext_source)
sourceFiles = findFilesNoSubdir(log, dir_source, ext_source)
destFiles = findFilesNoSubdir(log, dir_dest, ext_dest)
for file in sourceFiles:
sourceFile = dir_source + "/" + file
tagFile = dir_dest + "/" + file[0:-lenSrcExt] + ext_dest
if os.path.isfile(tagFile):
sourceTime = os.stat(sourceFile).st_mtime
tagTime = os.stat(tagFile).st_mtime
if (sourceTime > tagTime):
updateCount = updateCount + 1
else:
skipCount = skipCount + 1
else:
updateCount = updateCount + 1
if updateCount > 0:
printLog(log, "UPDATE " + str(updateCount) + " / " + str(len(sourceFiles)) + "; SKIP " + str(skipCount) + " / " + str(len(sourceFiles)) + "; DEST " + str(len(destFiles)))
return 1
else:
printLog(log, "SKIP " + str(skipCount) + " / " + str(len(sourceFiles)) + "; DEST " + str(len(destFiles)))
return 0
def needUpdateDirNoSubdirFile(log, dir_source, file_dest): def needUpdateDirNoSubdirFile(log, dir_source, file_dest):
if not os.path.isfile(file_dest): if not os.path.isfile(file_dest):