def imgur_upload(): client = ImgurClient(client_id, client_secret, access_token, refresh_token) albums = client.get_album_images("OKG9U3G") current_image_id = [image.id for image in albums] new_image_id = [] for file in file_list: # with open(os.devnull, "w") as f: # subprocess.call(["ect", file], stdout=f) # shutil.copy2(file, "/var/www/fgo.square.ovh/solomon-raid-stats/") id = client.upload_from_path(file, anon=False)["id"] new_image_id.append(id) print("{}: Uploaded to imgur".format(datetime.now())) for id in current_image_id: client.album_remove_images("OKG9U3G", id) for id in new_image_id: client.album_add_images("OKG9U3G", id) print("{}: Editted album".format(datetime.now()))
'positive_album_id': '0XfM8', 'negative_album_id': 'NX3p8' }, { 'album_id': '1EN5T', 'positive_album_id': 'OthOo', 'negative_album_id': 'jQIwZ' }] for album in albums: positive_images = [] negative_images = [] album_id = album['album_id'] positive_album_id = album['positive_album_id'] negative_album_id = album['negative_album_id'] for image in client.get_album_images(album_id): webbrowser.open(image.link) answer = raw_input('Activity on picture? (y/n/s): ') if answer == 's': break elif answer == 'y': positive_images.append(image.id) else: negative_images.append(image.id) client.album_add_images(positive_album_id, positive_images) client.album_add_images(negative_album_id, negative_images) client.album_remove_images(album_id, positive_images) client.album_remove_images(album_id, negative_images)