mirror of
https://gitlab.com/jeancf/twoot.git
synced 2024-11-27 22:11:11 +00:00
add upload pause to config
This commit is contained in:
parent
d6ed64d6fc
commit
fb8d83800e
|
@ -76,6 +76,12 @@ mastodon_user = ""
|
||||||
#
|
#
|
||||||
#tweet_delay = 15
|
#tweet_delay = 15
|
||||||
|
|
||||||
|
# How many seconds to pause between successive uploads of toots.
|
||||||
|
# Increase this value if successive tweets appear in the wrong order.
|
||||||
|
# Default is 0 (no pause)
|
||||||
|
#
|
||||||
|
# upload_pause = 5
|
||||||
|
|
||||||
# Maximum number of toots to post in each run
|
# Maximum number of toots to post in each run
|
||||||
# Default is 0 (which means unlimited)
|
# Default is 0 (which means unlimited)
|
||||||
#
|
#
|
||||||
|
|
9
twoot.py
9
twoot.py
|
@ -98,6 +98,7 @@ def build_config(args):
|
||||||
'remove_original_tweet_ref': False,
|
'remove_original_tweet_ref': False,
|
||||||
'tweet_max_age': float(1),
|
'tweet_max_age': float(1),
|
||||||
'tweet_delay': float(0),
|
'tweet_delay': float(0),
|
||||||
|
'upload_pause': float(0),
|
||||||
'toot_cap': int(0),
|
'toot_cap': int(0),
|
||||||
'subst_twitter': [],
|
'subst_twitter': [],
|
||||||
'subst_youtube': [],
|
'subst_youtube': [],
|
||||||
|
@ -1198,9 +1199,9 @@ def main(argv):
|
||||||
except MastodonAPIError:
|
except MastodonAPIError:
|
||||||
# Assuming this is an:
|
# Assuming this is an:
|
||||||
# ERROR ('Mastodon API returned error', 422, 'Unprocessable Entity', 'Cannot attach files that have not finished processing. Try again in a moment!')
|
# ERROR ('Mastodon API returned error', 422, 'Unprocessable Entity', 'Cannot attach files that have not finished processing. Try again in a moment!')
|
||||||
logging.warning('Mastodon API Error 422: Cannot attach files that have not finished processing. Waiting 60 seconds and retrying.')
|
logging.warning('Mastodon API Error 422: Cannot attach files that have not finished processing. Waiting 30 seconds and retrying.')
|
||||||
# Wait 60 seconds
|
# Wait 30 seconds
|
||||||
time.sleep(60)
|
time.sleep(30)
|
||||||
# retry posting
|
# retry posting
|
||||||
try:
|
try:
|
||||||
toot = mastodon.status_post(tweet['tweet_text'], media_ids=media_ids)
|
toot = mastodon.status_post(tweet['tweet_text'], media_ids=media_ids)
|
||||||
|
@ -1218,7 +1219,7 @@ def main(argv):
|
||||||
posted_cnt += 1
|
posted_cnt += 1
|
||||||
logging.debug('Tweet %s posted on %s', tweet['tweet_id'], TOML['config']['mastodon_user'])
|
logging.debug('Tweet %s posted on %s', tweet['tweet_id'], TOML['config']['mastodon_user'])
|
||||||
# Test to find out if slowing down successive posting helps with ordering of threads
|
# Test to find out if slowing down successive posting helps with ordering of threads
|
||||||
time.sleep(5)
|
time.sleep(TOML['options']['upload_pause'])
|
||||||
|
|
||||||
# Insert toot id into database
|
# Insert toot id into database
|
||||||
if 'id' in toot:
|
if 'id' in toot:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user