Add check for no image

This commit is contained in:
Antonio J. Delgado 2021-09-06 16:17:53 +03:00
parent 3a0cb54fa0
commit 660db24dec

View file

@ -66,12 +66,13 @@ class image_classifier:
move it to the folder of the day'''
self._log.debug(f"Processing file '{file}'...")
people = self.find_faces(file)
with open(file, 'rb') as image_file:
exif_info = exif.Image(image_file)
if exif_info.has_exif:
print(json.dumps(exif_info, indent=2))
# get date
# move to destination
if people:
with open(file, 'rb') as image_file:
exif_info = exif.Image(image_file)
if exif_info.has_exif:
print(json.dumps(exif_info, indent=2))
# get date
# move to destination
def load_known_people(self):
known_people = list()
@ -99,6 +100,7 @@ class image_classifier:
names.append(known_person['name'])
except PIL.UnidentifiedImageError as error:
self._log.debug(f"File '{file}' don't seem to be an image.")
return False
return names
def _init_log(self):