|
|
|
@ -20,7 +20,7 @@ import json
|
|
|
|
|
import pickle |
|
|
|
|
from os import path |
|
|
|
|
import subprocess |
|
|
|
|
from split_tweet import split_tweet |
|
|
|
|
from vendor import split_tweet |
|
|
|
|
|
|
|
|
|
database_filename = 'database.pkl' |
|
|
|
|
mastodon_character_limit = 500 |
|
|
|
@ -54,15 +54,16 @@ posts_list = list(posts)
|
|
|
|
|
post = posts_list[0] |
|
|
|
|
|
|
|
|
|
# Split-up facebook post into tweets according to character limit |
|
|
|
|
toots_text = split_tweet(post['post_text'], mastodon_character_limit - 30) |
|
|
|
|
toots_text = split_tweet.split_tweet(post['post_text'], mastodon_character_limit - 30) |
|
|
|
|
|
|
|
|
|
# Check if there is a new post, or the last one has been edited |
|
|
|
|
statuses = database[config['facebook_page']]['mastodon_statuses'] |
|
|
|
|
if post['post_id'] == database[config['facebook_page']]['last_post_id']: |
|
|
|
|
if database[config['facebook_page']]['last_edited'] == post['time']: |
|
|
|
|
print('No new posts to mirror') |
|
|
|
|
else: |
|
|
|
|
print('Last post has been updated') |
|
|
|
|
statuses = database[config['facebook_page']]['mastodon_statuses'] |
|
|
|
|
|
|
|
|
|
for status in statuses: |
|
|
|
|
Mastodon.status_delete(status['id']) |
|
|
|
|
else: |
|
|
|
|