Small refactor of _get_exif_data (use a dict comprehension).

This commit is contained in:
Simon Conseil
2014-05-31 23:07:12 +02:00
parent f41f7c9842
commit 6f0bcb2893

View File

@@ -164,16 +164,11 @@ def _get_exif_data(filename):
img = PILImage.open(filename)
exif = img._getexif() or {}
data = dict((TAGS.get(t, t), v) for (t, v) in exif.items())
data = {TAGS.get(tag, tag): value for tag, value in exif.items()}
if 'GPSInfo' in data:
gps_data = {}
for tag in data['GPSInfo']:
gps_data[GPSTAGS.get(tag, tag)] = data['GPSInfo'][tag]
data['GPSInfo'] = gps_data
data['GPSInfo'] = {GPSTAGS.get(tag, tag): value
for tag, value in data['GPSInfo'].items()}
return data