diff options
author | luxagraf@c63593aa-01b0-44d9-8516-4b9c7e931d7f <luxagraf@c63593aa-01b0-44d9-8516-4b9c7e931d7f> | 2010-05-06 22:46:22 +0000 |
---|---|---|
committer | luxagraf@c63593aa-01b0-44d9-8516-4b9c7e931d7f <luxagraf@c63593aa-01b0-44d9-8516-4b9c7e931d7f> | 2010-05-06 22:46:22 +0000 |
commit | 940e343ee500a990a2be45578708d3f5d9875263 (patch) | |
tree | 4f57ac3a994434582047decfa439d6c50b8a7f68 /apps/photos/utils.py | |
parent | 1b8c0ae77d1ffe6fe9af30e2c1646ea7cd2466c6 (diff) |
revamped slideshow with jquery, maps and exif data
Diffstat (limited to 'apps/photos/utils.py')
-rw-r--r-- | apps/photos/utils.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/apps/photos/utils.py b/apps/photos/utils.py index b3d8be1..24991b2 100644 --- a/apps/photos/utils.py +++ b/apps/photos/utils.py @@ -36,7 +36,7 @@ from photos.models import Photo,PhotoGallery API_KEY = settings.FLICKR_API_KEY from APIClients import FlickrClient -EXIF_PARAMS = {"Aperture":'f/2.8',"Make":'Apple',"Model":'iPhone',"Exposure":'',"ISO Speed":'',"Focal Length":'',"Shutter Speed":'','Date and Time (Original)':'2008:07:03 22:44:25'} +EXIF_PARAMS = {"Aperture":'f/2.8',"Make":'Apple',"Model":'iPhone',"Exposure":'',"ISO Speed":'',"Focal Length":'',"Shutter Speed":'',"Lens":'','Date and Time (Original)':'2008:07:03 22:44:25'} def sync_flickr_photos(*args, **kwargs): cur_page = 1 # Start on the first page of the stream @@ -63,6 +63,7 @@ def sync_flickr_photos(*args, **kwargs): tag = dict((k, smart_unicode(t.get(k))) for k in t.keys()) taglist.append(tag['raw']) exif = exif_handler(client.flickr_photos_getExif(user_id=API_KEY, photo_id=safestr(info['id']))) + photo = Photo.objects.create( title = info['title'], flickr_id = info['id'], @@ -76,9 +77,10 @@ def sync_flickr_photos(*args, **kwargs): exif_aperture = exif['Aperture'], exif_make = exif['Make'], exif_model = exif['Model'], - exif_shutter = exif['Exposure'], + exif_exposure = exif['Exposure'], exif_iso = exif['ISO Speed'], - exif_lens = exif['Focal Length'], + exif_lens = exif['Lens'], + exif_focal_length = exif['Focal Length'], exif_date = flickr_datetime_to_datetime(exif["Date and Time (Original)"].replace(':', '-', 2)), lat = float(info['latitude']), lon = float(info['longitude']), @@ -90,6 +92,7 @@ def sync_flickr_photos(*args, **kwargs): photo.save() make_local_copies(photo) slideshow_image(photo) + def exif_handler(data): converted = {} @@ -100,7 +103,11 @@ def exif_handler(data): if not converted.has_key("Aperture"): converted["Aperture"] = safestr(t.findtext('clean')) else: - converted[safestr(e['label'])] = safestr(t.findtext('raw')) + if safestr(e['tag']) != 'Exposure': + if safestr(e['tag']) == 'ExposureTime': + converted[safestr(e['label'])] = safestr(t.findtext('clean')) + else: + converted[safestr(e['label'])] = safestr(t.findtext('raw')) except: pass for k,v in EXIF_PARAMS.items(): |