def main(args):
    set_name = args.album_name

    flickr = FlickrTools(args.api_key, args.api_secret, args.token,
                         args.token_secret)

    set_id = flickr.photoset_id(set_name)
    pics = [p['id'] for p in flickr.pictures_in_photoset(set_id)]

    hashes = []
    for pic_id in pics:
        try:
            md5_hash = flickr.hash_by_photoid(pic_id)
        except:
            print("error during gathering hash of", pic_id)

        if md5_hash:
            if md5_hash in hashes:

                print("tagged", pic_id)

                if args.tag:
                    tags = args.tag.split(",")
                    for tag in tags:
                        flickr.add_tag(pic_id, tag)
                else:
                    flickr.add_tag(pic_id, "duplicate")
                    flickr.add_tag(pic_id, "duplicate_in_" + set_name)
            else:
                hashes.append(md5_hash)
def main(args):
    set_name = args.album_name
    tag = args.tag if args.tag else "duplicate"

    flickr = FlickrTools(args.api_key, args.api_secret, args.token,
                         args.token_secret)

    set_id = flickr.photoset_id(set_name)
    pics = [p['id'] for p in flickr.pictures_in_photoset(set_id)]
    for picture_id in pics:
        if contains_tag(picture_id, tag, flickr):
            print("remove", picture_id, "from", set_id)
            flickr.remove_from_set(picture_id, set_id)
Beispiel #3
0
def main(args):
    LOG.debug("flickr pic 2 album started")
    albumname = args.album_name if args.album_name else "Auto Upload"
    flickr = FlickrTools(args.api_key, args.api_secret, args.token,
                         args.token_secret)
    set_id = flickr.photoset_id(albumname)
    pics = flickr.pictures_in_photoset(set_id)

    for pic in pics:
        album = get_album(pic['title'])
        LOG.debug("album {} for {}".format(album, pic['title']))
        if album:
            add_pic_to_album(pic, album, flickr)