diff --git a/boost_mastodon.py b/boost_mastodon.py new file mode 100644 index 0000000..695e86e --- /dev/null +++ b/boost_mastodon.py @@ -0,0 +1,11 @@ +from load_config import config + +from mastodon import Mastodon + +m = Mastodon(access_token=config['boost_mastodon']['token'], api_base_url=config['boost_mastodon']['server']) + +def boost(url): + url = "pixelfed.scot/i/web/post/626860160148125215" + search_results = m.search(url, resolve=True) + print(search_results) + print("Error with searching") \ No newline at end of file diff --git a/main.py b/main.py index 02b143d..5c6da3a 100644 --- a/main.py +++ b/main.py @@ -44,15 +44,27 @@ def main(): item_data = image_processing.get_image_data(item) file_data.append(item_data) + # Collection of post URL's which can be used for sharing features + # Where the API used doesn't support responding with a URL, a status + # message is provided. + posts = {} + if load_config.config['flickr']['enable']: print("Flickr publishing enabled") import publish_flickr - publish_flickr.upload(file_data) + posts['flickr'] = publish_flickr.upload(file_data) if load_config.config['pixelfed']['enable']: print("Pixelfed publishing enabled") import publish_pixelfed - publish_pixelfed.upload(file_data) + posts['pixelfed'] = publish_pixelfed.upload(file_data) + + if load_config.config['boost_mastodon']['enable']: + print("Mastodon Boost enabled") + import boost_mastodon + # TESTING CALL: + boost_mastodon.boost("e") + #posts['mastodon_boost'] = boost_mastodon.boost(posts['pixelfed']) def list_files_in_directory(directory): top_level_items = os.listdir(directory) diff --git a/publish_facebook.py b/publish_facebook.py new file mode 100644 index 0000000..e69de29 diff --git a/publish_pixelfed.py b/publish_pixelfed.py index 5a690d9..b00081e 100644 --- a/publish_pixelfed.py +++ b/publish_pixelfed.py @@ -2,7 +2,7 @@ import load_config from mastodon import Mastodon -m = Mastodon(access_token=load_config.config['pixelfed']['token'], api_base_url="https://pixelfed.scot") +m = Mastodon(access_token=load_config.config['pixelfed']['token'], api_base_url=load_config.config['pixelfed']['server']) def upload(file_data: list): for file in file_data: @@ -10,6 +10,7 @@ def upload(file_data: list): media_upload = m.media_post(file['path'], "image/jpeg") print("Posting to Pixelfed") post_upload = m.status_post(formatPost(file), media_ids = media_upload['id']) + return post_upload['url'] def formatPost(file: dict): tag_string = formatTags(file['tags'])