Beispiel #1
0
def index_set_photos(photoset, index):
    """Add all photos in photoset to the specified DownloadIndex."""
    photos = normalize_json(API.photosets_getPhotos(photoset_id=photoset.id))
    photos = dotdict(photos['photoset'])

    # TODO: We need to add pagination support for big sets.
    assert int(photos.total) == len(photos.photo), "This user has set with too many photos."

    print "Indexing the %s photos in this set:\n" % photos.total

    for idx, photo in enumerate(photos.photo, 1):
        photo = Photo(photo)

        print "%s. %s" % (idx, photo.details)

        index.add_to_index(photo, photoset)