Half fix append people

This commit is contained in:
Antonio J. Delgado 2021-09-06 21:28:44 +03:00
parent e9c8e9ac06
commit 9beade82bd

View file

@ -76,20 +76,18 @@ class image_classifier:
self.iptc_info.save() self.iptc_info.save()
self._log.debug(f"Updated file '{file}'.") self._log.debug(f"Updated file '{file}'.")
# get date # get date
self._log.debug(f"File time stamp: {self.iptc_info.get('Image timestamp')} (type: {type(self.exif_info.get('Image timestamp'))})") self._log.debug(f"File time stamp: {self.iptc_info['Image timestamp']} (type: {type(self.iptc_info['Image timestamp'])})")
# move to destination # move to destination
else: else:
self._log.debug("Doesn't seem to be an image.") self._log.debug("Doesn't seem to be an image.")
def append_people(self, people): def append_people(self, people):
if self.is_json(self.iptc_info.get('user_comment')): if self.is_json(self.iptc_info['Person shown']):
data = json.loads(self.iptc_info['user_comment']) data = json.loads(self.iptc_info['Person shown'])
if 'Person shown' not in data:
data['Person shown'] = list()
else: else:
data = dict() data = dict()
if self.exif_iptc_infoinfo.get('user_comment'): if self.iptc_infoinfo['Person shown']:
data["previous_user_comment"]=self.iptc_info.get('user_comment') data["previous_user_comment"]=self.iptc_info['user_comment']
data['Person shown'] = list() data['Person shown'] = list()
for person in people: for person in people:
if person not in data['Person shown']: if person not in data['Person shown']: