Add function to test for json string
This commit is contained in:
parent
d128e8844d
commit
e121afdbea
1 changed files with 8 additions and 1 deletions
|
@ -68,12 +68,15 @@ class image_classifier:
|
||||||
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.")
|
||||||
|
self._log.debug(json.dumps(people, indent=2))
|
||||||
with open(file, 'rb') as image_file:
|
with open(file, 'rb') as image_file:
|
||||||
exif_info = exif.Image(image_file)
|
exif_info = exif.Image(image_file)
|
||||||
if exif_info.has_exif:
|
if exif_info.has_exif:
|
||||||
for key in exif_info.list_all():
|
for key in exif_info.list_all():
|
||||||
if key != 'cannot read a base/unknown IFD tag instance':
|
if key != 'cannot read a base/unknown IFD tag instance':
|
||||||
print(f"{key}: {exif_info[key]}")
|
sys.stdout.write(f"{key}: ")
|
||||||
|
sys.stdout.write(exif_info[key])
|
||||||
|
#exif_info["user_comment"]
|
||||||
else:
|
else:
|
||||||
self._log.debug("No exif info in the image.")
|
self._log.debug("No exif info in the image.")
|
||||||
# get date
|
# get date
|
||||||
|
@ -81,6 +84,10 @@ class image_classifier:
|
||||||
else:
|
else:
|
||||||
self._log.debug("Doesn't seem to be an image.")
|
self._log.debug("Doesn't seem to be an image.")
|
||||||
|
|
||||||
|
def is_json(self, data):
|
||||||
|
result = json.loads(data)
|
||||||
|
return True
|
||||||
|
|
||||||
def load_known_people(self):
|
def load_known_people(self):
|
||||||
known_people = list()
|
known_people = list()
|
||||||
self._log.debug(f"Looking for known faces in directory '{self.faces_directory}'...")
|
self._log.debug(f"Looking for known faces in directory '{self.faces_directory}'...")
|
||||||
|
|
Loading…
Reference in a new issue