mirror of
https://gitlab.com/jeancf/twoot.git
synced 2025-03-27 16:06:46 +00:00
Reworked default config
This commit is contained in:
parent
bad9c1f44c
commit
82b037aaa1
@ -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
|
||||
|
14
twoot.py
14
twoot.py
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user