Replaced max_age min_delay and cap

This commit is contained in:
jeancf 2022-11-18 17:06:46 +01:00
parent 739009ba97
commit b161118cf8

View File

@ -402,11 +402,6 @@ def main(argv):
print('CRITICAL: Missing Mastodon user password')
exit(-1)
# remove_trackers = args['u']
# max_age = float(args['a'])
# min_delay = float(args['d'])
# cap = int(args['c'])
# Remove previous log file
try:
os.remove(toml['config']['twitter_account'] + '.log')
@ -534,7 +529,7 @@ def main(argv):
timestamp = datetime.datetime.strptime(time_string, '%b %d, %Y · %I:%M %p %Z').timestamp()
# Check if time is within acceptable range
if not is_time_valid(timestamp, max_age, min_delay):
if not is_time_valid(timestamp, toml['options']['tweet_max_age'], toml['options']['tweet_delay']):
out_date_cnt += 1
logging.debug("Tweet outside valid time range, skipping")
continue
@ -683,8 +678,8 @@ def main(argv):
posted_cnt = 0
for tweet in reversed(tweets):
# Check if we have reached the cap on the number of toots to post
if cap != 0 and posted_cnt >= cap:
logging.info('%d toots not posted due to configured cap', len(tweets) - cap)
if toml['options']['toot_cap'] != 0 and posted_cnt >= toml['options']['toot_cap']:
logging.info('%d toots not posted due to configured cap', len(tweets) - toml['options']['toot_cap'])
break
logging.debug('Uploading Tweet %s', tweet["tweet_id"])