Browse Source

fix logical error for main mirror decision stage

master
hfte 2 years ago
parent
commit
668ccfdf27
  1. 15
      mastaface.py

15
mastaface.py

@ -35,7 +35,7 @@ mastodon = Mastodon(
api_base_url = config['mastodon_api_base_url']
)
# Get history/database
# Get history-database
# Check if Database file exists
if path.exists(database_filename):
database = pickle.load( open( database_filename, "rb" ) )
@ -57,16 +57,11 @@ post = posts_list[0]
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')
for status in statuses:
if post['time'] != database[config['facebook_page']]['last_edited']:
if post['post_id'] == database[config['facebook_page']]['last_post_id']:
# Last post has been updated, so first delete the old toot
for status in database[config['facebook_page']]['mastodon_statuses']:
Mastodon.status_delete(status['id'])
else:
statuses = None
statuses = []
# Upload image if it exists

Loading…
Cancel
Save