Change test for no move

This commit is contained in:
Antonio J. Delgado 2021-09-08 14:42:59 +03:00
parent 0850f4af39
commit d3117d61eb

View file

@ -86,7 +86,7 @@ class image_classifier:
self._log.debug(f"Updated file '{file}'.")
dirname = os.path.dirname(os.path.realpath(file))
filename = os.path.basename(file)
if not self.no_move:
new_path = False
if 'Exif.Photo.DateTimeOriginal' in self.metadata.exif_keys:
original_date = self.metadata['Exif.Photo.DateTimeOriginal'].value
@ -103,10 +103,11 @@ class image_classifier:
if not new_path:
new_path = os.path.join(dirname, 'unknown-time', filename)
os.makedirs(os.path.dirname(new_path), exist_ok=True)
if self.no_move == False:
self._log.info(f"Moving file '{file}' to '{new_path}'...")
shutil.move(file, new_path)
else:
self._log.debug('Not moving to subfolders.')
self._log.info(f"NOT moving file '{file}' to '{new_path}' because of --no-move")
def print_metadata(self):
print("IPTC keys:")