move dirname and filename

This commit is contained in:
Antonio J. Delgado 2021-09-08 14:46:03 +03:00
parent 7599c9ede0
commit 8d2f6cbb77

View file

@ -73,6 +73,8 @@ class image_classifier:
else: else:
self.metadata = pyexiv2.ImageMetadata(file) self.metadata = pyexiv2.ImageMetadata(file)
self.metadata.read() self.metadata.read()
dirname = os.path.dirname(os.path.realpath(file))
filename = os.path.basename(file)
people = self.find_faces(file) people = self.find_faces(file)
if people: if people:
self._log.debug(f"Found {len(people)} known people in the image.") self._log.debug(f"Found {len(people)} known people in the image.")
@ -83,9 +85,6 @@ class image_classifier:
self._log.debug(f"People (after): {self.metadata['Xmp.iptcExt.PersonInImage'].raw_value} (type: {type(self.metadata['Xmp.iptcExt.PersonInImage'].raw_value)})") self._log.debug(f"People (after): {self.metadata['Xmp.iptcExt.PersonInImage'].raw_value} (type: {type(self.metadata['Xmp.iptcExt.PersonInImage'].raw_value)})")
self.metadata.write() self.metadata.write()
self._log.debug(f"Updated file '{file}'.") self._log.debug(f"Updated file '{file}'.")
dirname = os.path.dirname(os.path.realpath(file))
filename = os.path.basename(file)
new_path = False new_path = False
if 'Exif.Photo.DateTimeOriginal' in self.metadata.exif_keys: if 'Exif.Photo.DateTimeOriginal' in self.metadata.exif_keys:
original_date = self.metadata['Exif.Photo.DateTimeOriginal'].value original_date = self.metadata['Exif.Photo.DateTimeOriginal'].value