Skip to content

Instantly share code, notes, and snippets.

@bergerx
Created July 27, 2014 20:34
Show Gist options
  • Save bergerx/36b725cd466c9f276a1c to your computer and use it in GitHub Desktop.
Save bergerx/36b725cd466c9f276a1c to your computer and use it in GitHub Desktop.
time zone correction on uploaded images to flickr
import arrow
import flickr_api
tag='timeshift'
hours=-10
flickr_authfile = 'flickr.auth'
flickr_username = 'bergerx'
flickr_api.set_auth_handler(flickr_authfile)
#user = flickr_api.Person.findByUserName(flickr_username)
album = flickr_api.Photoset(id='72157645970891955')
for photo in album.getPhotos():
print photo.title, photo.id,
if photo.title[0:3] not in ('DSC', 'MAQ'):
print "pass"
continue
date_taken_orig = photo.getInfo()['taken']
date_taken = arrow.get(date_taken_orig).replace(hours=hours).format('YYYY-MM-DD HH:mm:ss')
tags = [i.raw.split(':')[0] for i in photo.getTags()]
if tag in tags:
print 'SKIP, aldready done'
continue
photo.addTags([
'%s:orig=%s' % (tag, date_taken_orig),
'%s:shift=%s' % (tag, hours)
])
photo.setDates(date_taken=date_taken)
print 'DONE', date_taken_orig, '-->', date_taken
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment