summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/photos/readexif.py45
1 files changed, 36 insertions, 9 deletions
diff --git a/app/photos/readexif.py b/app/photos/readexif.py
index 0b3f7f7..71416ff 100644
--- a/app/photos/readexif.py
+++ b/app/photos/readexif.py
@@ -47,13 +47,40 @@ def readexif(image):
image.exif_aperture = meta["EXIF:FNumber"]
except:
pass
- image.exif_make = meta["EXIF:Make"]
- image.exif_model = meta["EXIF:Model"]
- image.exif_exposure = str(Fraction(float(meta["EXIF:ExposureTime"])).limit_denominator())
- image.exif_iso = meta["EXIF:ISO"]
- image.exif_focal_length = meta["EXIF:FocalLength"]
- fmt_date = time.strptime(meta["EXIF:DateTimeOriginal"], "%Y:%m:%d %H:%M:%S")
- image.exif_date = time.strftime("%Y-%m-%d %H:%M:%S", fmt_date)
- image.height = meta["File:ImageHeight"]
- image.width = meta["File:ImageWidth"]
+ try:
+ image.exif_make = meta["EXIF:Make"]
+ except:
+ pass
+ try:
+ image.exif_model = meta["EXIF:Model"]
+ except:
+ pass
+ try:
+ image.exif_exposure = str(Fraction(float(meta["EXIF:ExposureTime"])).limit_denominator())
+ except:
+ pass
+ try:
+ image.exif_iso = meta["EXIF:ISO"]
+ except:
+ pass
+ try:
+ image.exif_focal_length = meta["EXIF:FocalLength"]
+ except:
+ pass
+ try:
+ fmt_date = time.strptime(meta["EXIF:DateTimeOriginal"], "%Y:%m:%d %H:%M:%S")
+ except:
+ pass
+ try:
+ image.exif_date = time.strftime("%Y-%m-%d %H:%M:%S", fmt_date)
+ except:
+ pass
+ try:
+ image.height = meta["File:ImageHeight"]
+ except:
+ pass
+ try:
+ image.width = meta["File:ImageWidth"]
+ except:
+ pass
return image