mirror of
https://gitlab.com/jeancf/twoot.git
synced 2024-11-27 22:11:11 +00:00
Config loading OK
This commit is contained in:
parent
06e4e8b9a2
commit
c8986ad5fb
44
twoot.py
44
twoot.py
|
@ -339,10 +339,10 @@ def main(argv):
|
|||
'upload_videos': False,
|
||||
'post_reply_to': False,
|
||||
'skip_retweets': False,
|
||||
'remove_trackers_from_url': False,
|
||||
'remove_trackers_from_urls': False,
|
||||
'tweet_max_age': float(1),
|
||||
'tweet_delay': float(0),
|
||||
'toot_cap': int(1),
|
||||
'toot_cap': int(0),
|
||||
}
|
||||
|
||||
# Default empty toml
|
||||
|
@ -372,14 +372,14 @@ def main(argv):
|
|||
toml['config']['mastodon_instance'] = args['i']
|
||||
if args['m'] is not None:
|
||||
toml['config']['mastodon_user'] = args['m']
|
||||
if args['v'] is not None:
|
||||
if args['v'] is True:
|
||||
toml['options']['upload_videos'] = args['v']
|
||||
if args['r'] is not None:
|
||||
if args['r'] is True:
|
||||
toml['options']['post_reply_to'] = args['r']
|
||||
if args['s'] is not None:
|
||||
if args['s'] is True:
|
||||
toml['options']['skip_retweets'] = args['s']
|
||||
if args['u'] is not None:
|
||||
toml['options']['remove_trackers_from_url'] = args['u']
|
||||
if args['u'] is True:
|
||||
toml['options']['remove_trackers_from_urls'] = args['u']
|
||||
if args['a'] is not None:
|
||||
toml['options']['tweet_max_age'] = float(args['a'])
|
||||
if args['d'] is not None:
|
||||
|
@ -411,10 +411,10 @@ def main(argv):
|
|||
# cap = int(args['c'])
|
||||
|
||||
# Remove previous log file
|
||||
# try:
|
||||
# os.remove(twit_account + '.log')
|
||||
# except FileNotFoundError:
|
||||
# pass
|
||||
try:
|
||||
os.remove(toml['config']['twitter_account'] + '.log')
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
|
||||
# Setup logging to file
|
||||
logging.basicConfig(
|
||||
|
@ -424,17 +424,17 @@ def main(argv):
|
|||
datefmt='%Y-%m-%d %H:%M:%S',
|
||||
)
|
||||
|
||||
# logging.info('Running with the following parameters:')
|
||||
# logging.info(' -f ' + str(toml_file))
|
||||
# logging.info(' -t ' + twit_account)
|
||||
# logging.info(' -i ' + mast_instance)
|
||||
# logging.info(' -m ' + mast_account)
|
||||
# logging.info(' -r ' + str(tweets_and_replies))
|
||||
# logging.info(' -s ' + str(suppress_retweets))
|
||||
# logging.info(' -v ' + str(get_vids))
|
||||
# logging.info(' -a ' + str(max_age))
|
||||
# logging.info(' -d ' + str(min_delay))
|
||||
# logging.info(' -c ' + str(cap))
|
||||
logging.info('Running with the following parameters:')
|
||||
logging.info(' -f ' + str(toml_file))
|
||||
logging.info(' -t ' + toml['config']['twitter_account'])
|
||||
logging.info(' -i ' + toml['config']['mastodon_instance'])
|
||||
logging.info(' -m ' + toml['config']['mastodon_user'])
|
||||
logging.info(' -r ' + str(toml['options']['post_reply_to']))
|
||||
logging.info(' -s ' + str(toml['options']['skip_retweets']))
|
||||
logging.info(' -v ' + str(toml['options']['upload_videos']))
|
||||
logging.info(' -a ' + str(toml['options']['tweet_max_age']))
|
||||
logging.info(' -d ' + str(toml['options']['tweet_delay']))
|
||||
logging.info(' -c ' + str(toml['options']['toot_cap']))
|
||||
|
||||
print(toml)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user