Improved config

This commit is contained in:
jeancf 2022-11-28 20:02:20 +01:00
parent fbe99609d2
commit bad9c1f44c
2 changed files with 9 additions and 6 deletions

View File

@ -1,12 +1,12 @@
[config]
# twitter account name without '@'
twitter_account = ""
twitter_account = "unrealengine"
# Domain name of Mastodon instance
mastodon_instance = ""
mastodon_instance = "m"
# Mastodon username (login email address)
mastodon_user = ""
mastodon_user = "u"
[options]
# Download videos from twitter and upload them on Mastodon

View File

@ -511,13 +511,13 @@ def main(argv):
mast_password = args['p']
# Verify that we have a minimum config to run
if 'twitter_account' not in TOML['config'].keys():
if 'twitter_account' not in TOML['config'].keys() or TOML['config']['twitter_account'] == "":
print('CRITICAL: Missing Twitter account')
exit(-1)
if 'mastodon_instance' not in TOML['config'].keys():
if 'mastodon_instance' not in TOML['config'].keys() or TOML['config']['mastodon_instance'] == "":
print('CRITICAL: Missing Mastodon instance')
exit(-1)
if 'mastodon_user' not in TOML['config'].keys():
if 'mastodon_user' not in TOML['config'].keys() or TOML['config']['mastodon_user'] == "":
print('CRITICAL: Missing Mastodon user')
exit(-1)
if mast_password is None:
@ -551,6 +551,9 @@ def main(argv):
logging.info(' tweet_max_age : ' + str(TOML['options']['tweet_max_age']))
logging.info(' tweet_delay : ' + str(TOML['options']['tweet_delay']))
logging.info(' toot_cap : ' + str(TOML['options']['toot_cap']))
logging.info(' twitter substitution : ' + str(TOML['options']['substitution']['twitter']))
logging.info(' youtube substitution : ' + str(TOML['options']['substitution']['youtube']))
logging.info(' reddit substitution : ' + str(TOML['options']['substitution']['reddit']))
# Try to open database. If it does not exist, create it
sql = sqlite3.connect('twoot.db')