move dirname and filename

This commit is contained in:
Antonio J. Delgado 2021-09-08 15:37:44 +03:00
parent 5d2a27d186
commit 545fff5c2d

View file

@ -69,14 +69,14 @@ class image_classifier:
move it to the folder of the day''' move it to the folder of the day'''
self._log.debug(f"Looking for faces in file '{file}'...") self._log.debug(f"Looking for faces in file '{file}'...")
new_path = False new_path = False
dirname = os.path.dirname(os.path.realpath(file))
filename = os.path.basename(file)
if not os.access(file, os.R_OK): if not os.access(file, os.R_OK):
self._log.error(f"The file '{file}' is not readable.") self._log.error(f"The file '{file}' is not readable.")
else: else:
if self.is_image(file): if self.is_image(file):
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.")