Cleanup whitespace.
This commit is contained in:
parent
db3970d4a5
commit
a1266c6aa2
|
@ -18,7 +18,7 @@ def getMinimumCreationTime(exif_data):
|
|||
if (dateTimeOriginal is None):
|
||||
# case 1/9: dateTime, dateTimeOriginal, and dateTimeDigitized = None
|
||||
# case 2/9: dateTime and dateTimeOriginal = None, then use dateTimeDigitized
|
||||
creationTime = dateTimeDigitized
|
||||
creationTime = dateTimeDigitized
|
||||
else:
|
||||
# case 3/9: dateTime and dateTimeDigitized = None, then use dateTimeOriginal
|
||||
# case 4/9: dateTime = None, prefere dateTimeOriginal over dateTimeDigitized
|
||||
|
@ -33,7 +33,7 @@ def postprocessImage(images, imageDirectory, fileName):
|
|||
imagePath = os.path.join(imageDirectory, fileName)
|
||||
image = open(imagePath, 'rb')
|
||||
creationTime = None
|
||||
try:
|
||||
try:
|
||||
exifTags = exifread.process_file(image, details=False)
|
||||
creationTime = getMinimumCreationTime(exifTags)
|
||||
except:
|
||||
|
@ -89,7 +89,7 @@ def writeImages(images, destinationRoot, splitByMonth=False):
|
|||
createUnknownDateFolder(destinationRoot)
|
||||
destination = os.path.join(destinationRoot, unknownDateFolderName)
|
||||
destinationFilePath = os.path.join(destination, fileName)
|
||||
|
||||
|
||||
else:
|
||||
if (previousTime == None) or ((previousTime + minEventDelta) < imageTuple[0]):
|
||||
eventNumber = eventNumber + 1
|
||||
|
|
|
@ -16,12 +16,12 @@ def limitFilesPerFolder(folder, maxNumberOfFilesPerFolder):
|
|||
if not os.path.exists(subFolderPath):
|
||||
os.mkdir(subFolderPath)
|
||||
fileCounter = 1
|
||||
for file in os.listdir(dirPath):
|
||||
for file in os.listdir(dirPath):
|
||||
source = os.path.join(dirPath, file)
|
||||
if os.path.isfile(source):
|
||||
destDir = str(((fileCounter - 1) // maxNumberOfFilesPerFolder) + 1)
|
||||
destination = os.path.join(dirPath, destDir, file)
|
||||
shutil.move(source, destination)
|
||||
fileCounter += 1
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -30,12 +30,12 @@ def log(logString):
|
|||
def moveFile(file, destination):
|
||||
extension = os.path.splitext(file)[1][1:].upper()
|
||||
sourcePath = os.path.join(root, file)
|
||||
|
||||
|
||||
destinationDirectory = os.path.join(destination, extension)
|
||||
|
||||
if not os.path.exists(destinationDirectory):
|
||||
os.mkdir(destinationDirectory)
|
||||
|
||||
|
||||
fileName = str(fileCounter) + "." + extension.lower()
|
||||
destinationFile = os.path.join(destinationDirectory, fileName)
|
||||
if not os.path.exists(destinationFile):
|
||||
|
@ -75,12 +75,12 @@ for root, dirs, files in os.walk(source, topdown=False):
|
|||
for file in files:
|
||||
extension = os.path.splitext(file)[1][1:].upper()
|
||||
sourcePath = os.path.join(root, file)
|
||||
|
||||
|
||||
destinationDirectory = os.path.join(destination, extension)
|
||||
|
||||
if not os.path.exists(destinationDirectory):
|
||||
os.mkdir(destinationDirectory)
|
||||
|
||||
|
||||
fileName = str(fileCounter) + "." + extension.lower()
|
||||
destinationFile = os.path.join(destinationDirectory, fileName)
|
||||
if not os.path.exists(destinationFile):
|
||||
|
|
Loading…
Reference in New Issue