Guard the string lookups better.
This commit is contained in:
parent
ddba74b57c
commit
fb01d666b8
@ -152,6 +152,7 @@ class Photo(object):
|
||||
self._orientation = exif["Orientation"];
|
||||
if self._orientation in range(5, 9):
|
||||
self._attributes["size"] = (self._attributes["size"][1], self._attributes["size"][0])
|
||||
if self._orientation - 1 < len(self._metadata.orientation_list):
|
||||
self._attributes["orientation"] = self._metadata.orientation_list[self._orientation - 1]
|
||||
if "Make" in exif:
|
||||
self._attributes["make"] = exif["Make"]
|
||||
@ -171,21 +172,16 @@ class Photo(object):
|
||||
self._attributes["iso"] = exif["PhotographicSensitivity"]
|
||||
if "ExposureTime" in exif:
|
||||
self._attributes["exposureTime"] = exif["ExposureTime"]
|
||||
if "MeteringMode" in exif:
|
||||
self._attributes["meteringMode"] = exif["MeteringMode"]
|
||||
if "Flash" in exif:
|
||||
if "Flash" in exif and exif["Flash"] in self._metadata.flash_dictionary:
|
||||
try:
|
||||
self._attributes["flash"] = self._metadata.flash_dictionary[exif["Flash"]]
|
||||
except:
|
||||
pass
|
||||
if "ExposureProgram" in exif:
|
||||
if "ExposureProgram" in exif and exif["ExposureProgram"] < len(self._metadata.exposure_list):
|
||||
self._attributes["exposureProgram"] = self._metadata.exposure_list[exif["ExposureProgram"]]
|
||||
if "SpectralSensitivity" in exif:
|
||||
self._attributes["spectralSensitivity"] = exif["SpectralSensitivity"]
|
||||
if "MeteringMode" in exif:
|
||||
if exif["MeteringMode"] == 255:
|
||||
self._attributes["meteringMode"] = "Other"
|
||||
else:
|
||||
if "MeteringMode" in exif and exif["MeteringMode"] < len(self._metadata.metering_list):
|
||||
self._attributes["meteringMode"] = self._metadata.metering_list[exif["MeteringMode"]]
|
||||
if "ExposureCompensation" in exif:
|
||||
self._attributes["exposureCompensation"] = exif["ExposureCompensation"]
|
||||
|
Loading…
Reference in New Issue
Block a user