def myAddMissingPhotos(local_photosets, flickr_photosets): for local_photoset in local_photosets: for flickr_photoset in flickr_photosets: if local_photoset.title == flickr_photoset.title: print "Checking: ", local_photoset.title # Found matching set local_photos = local_photoset.getPhotos() flickr_photos = flickr_photoset.getPhotos() # Now find the missing photos within this set, if any missing_photos = myFindMissingPhotoObjects(local_photos, flickr_photos) # For every missing photo add it to the identified set for missing_photo in missing_photos: mytitle=missing_photo.title.rstrip('.JPG') photo = flickrupload.upload(filename=missing_photo.fullname, title=mytitle) print "Added photo: ", photo.title flickr_photoset.addPhoto(photo)
def myAddMissingPhotoSets(photoset_delta): me = flickr.User(myflickrinfo.FLICKRUSER) for missing_set in photoset_delta: mylocal_photos = missing_set.getPhotos() print "Adding set: ", missing_set.title print "Missing photos:" create_set = True for missing_photo in mylocal_photos: print missing_photo.fullname try: photo = flickrupload.upload(filename=missing_photo.fullname, title=missing_photo.title.rstrip('.JPG')) except FlickrError: print "ERROR FOUND:" else: if create_set == True: newphotoset = me.createPhotoset(photo, missing_set.title) create_set = False else: newphotoset.addPhoto(photo)