From 622a58984e3afc91cf28d2610e88fbf5f5f03126 Mon Sep 17 00:00:00 2001 From: rrr-marble Date: Thu, 1 Jul 2021 22:20:45 +0300 Subject: [PATCH] add: yield the db info for each img processed --- util/import_photos.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/util/import_photos.py b/util/import_photos.py index d5ce5cf..231e45c 100644 --- a/util/import_photos.py +++ b/util/import_photos.py @@ -52,8 +52,16 @@ def process_pictures(): # Q: do we strip exif from originals? move(path.join(root, filename), DEST_ORIGINAL) - # update the database - pass + # return the freshly processed picture info + yield { + "ResizedImage": path.join(DEST_STRUNK, filename), + "OriginalImage": path.join(DEST_ORIGINAL, filename), + "DateTimeOriginal": exif["DateTimeOriginal"], # Q: normalize it? + "GPSLatitude": exif["GPSLatitude"], + "GPSLatitudeRef": exif["GPSLatitudeRef"], + "GPSLongitude": exif["GPSLongitude"], + "GPSLongitudeRef": exif["GPSLongitudeRef"], + } def update_database(): @@ -80,6 +88,8 @@ def main(): exit(1) # process each pic and add it to the database + for pic in process_pictures(): + print(pic) # just print into strout for now if __name__ == "__main__":