Reworked default config

This commit is contained in:
jeancf 2022-11-28 21:49:04 +01:00
parent bad9c1f44c
commit 82b037aaa1
2 changed files with 7 additions and 13 deletions

View File

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

View File

@ -159,8 +159,6 @@ def substitute_source(orig_url):
logging.debug("Checking domain %s for substitution ", domain)
logging.debug(TOML)
# Handle twitter
twitter_subst = TOML["options"]["substitution"]["twitter"]
if domain.find('twitter.com') >=0 and twitter_subst != []:
@ -441,11 +439,6 @@ def main(argv):
# Create global struct containing configuration
global TOML
# We build the configuration by layering for each parameter:
# 1. A default value
# 2. The values read from the config file
# 3. The value provided on the command line
# Default options
substitution = {
'twitter': [],
@ -465,9 +458,6 @@ def main(argv):
'substitution': substitution,
}
# Default toml
TOML = {'config': {}, 'options': options}
# Parse command line
args = vars(parser.parse_args())
@ -484,6 +474,10 @@ def main(argv):
except tomli.TOMLDecodeError:
print('Malformed config file')
exit(-1)
else:
# Default toml
TOML = {'config': {}, 'options': options}
# Override config parameters with command-line values if provided
if args['t'] is not None: