add: skip adding images with invalid exif to db

pull/5/head
rrr-marble 4 years ago
parent a1cd63eca0
commit b78c53441d

@ -41,6 +41,7 @@ def process_pictures(source: str, dest_shrunk: str, dest_original: str):
# Q: do we strip exif from originals?
move(path.join(root, filename), dest_original)
try:
# return the freshly processed picture info
yield {
"ResizedImage": path.join(dest_shrunk, filename),
@ -51,6 +52,9 @@ def process_pictures(source: str, dest_shrunk: str, dest_original: str):
"GPSLongitude": exif["GPSLongitude"],
"GPSLongitudeRef": exif["GPSLongitudeRef"],
}
except KeyError as e:
print(f"Image '{filename}' has no valid exif")
continue
def update_database(pic_info: dict, db_location: str):

Loading…
Cancel
Save