Merge remote-tracking branch 'gitlab/no_match'

This commit is contained in:
jeancf 2022-12-21 15:10:14 +01:00
commit fa11764b84
3 changed files with 45 additions and 34 deletions

View File

@ -1,5 +1,26 @@
# Changelog # Changelog
**11 DEC 2022**
VERSION 3.1 HOTFIX
* Added missing `default.toml` file
* Corrected a bug that could cause an infinity loop when log file is empty
VERSION 3.0 brings some important changes and new features:
* Only potentially breaking change: **If you are using a version of python < 3.11 you need to install the `tomli` module**
* Twoot can be configured with a config file in [TOML](https://toml.io/) format. Check `default.toml` for details
* Domain susbtitution can be configured in the config file to replace links to Twitter, Youtube and
Reddit domains with alternatives (e.g. [Nitter](https://github.com/zedeus/nitter/wiki/Instances),
[Invidious](https://redirect.invidious.io/) and [teddit](https://teddit.net/) respectively)
* A footer line can be specified in the config file that gets added to all toots (with e.g. tags)
* Added option to not add reference to "Original tweet" at the bottom of toots
* A password must be provided with `-p` on the command-line for the first run only. After that it is no longer required.
* The verbosity of logging messages can be set in the config file with `log_level=`.
* Config file option `log_days =` specifies how long to keep log messages in file. Older messages are deleted.
**23 NOV 2022** VERSION 2.5 Added command-line option (`-l`) to remove **23 NOV 2022** VERSION 2.5 Added command-line option (`-l`) to remove
redirection from links included in tweets. Obfuscated links are replaced redirection from links included in tweets. Obfuscated links are replaced
by the URL that the resource is directly downloaded from. Also improved by the URL that the resource is directly downloaded from. Also improved

View File

@ -3,24 +3,9 @@
Twoot is a python script that mirrors tweets from a twitter account to a Mastodon account. Twoot is a python script that mirrors tweets from a twitter account to a Mastodon account.
It is simple to set-up on a local machine, configurable and feature-rich. It is simple to set-up on a local machine, configurable and feature-rich.
**UPDATE 11 DEC 2022** **UPDATE 21 DEC 2022** VERSION 3.1.1
VERSION 3.1 HOTFIX
* Added missing `default.toml` file Modified code that made twoot incompatible with python versions < 3.10
* Corrected a bug that could cause an infinity loop when log file is empty
VERSION 3.0 brings some important changes and new features:
* Only potentially breaking change: **If you are using a version of python < 3.11 you need to install the `tomli` module**
* Twoot can be configured with a config file in [TOML](https://toml.io/) format. Check `default.toml` for details
* Domain susbtitution can be configured in the config file to replace links to Twitter, Youtube and
Reddit domains with alternatives (e.g. [Nitter](https://github.com/zedeus/nitter/wiki/Instances),
[Invidious](https://redirect.invidious.io/) and [teddit](https://teddit.net/) respectively)
* A footer line can be specified in the config file that gets added to all toots (with e.g. tags)
* Added option to not add reference to "Original tweet" at the bottom of toots
* A password must be provided with `-p` on the command-line for the first run only. After that it is no longer required.
* The verbosity of logging messages can be set in the config file with `log_level=`.
* Config file option `log_days =` specifies how long to keep log messages in file. Older messages are deleted.
> Previous updates can be found in CHANGELOG. > Previous updates can be found in CHANGELOG.

View File

@ -634,24 +634,29 @@ def main(argv):
datefmt='%Y-%m-%d %H:%M:%S', datefmt='%Y-%m-%d %H:%M:%S',
) )
# Set level of logging # Set default level of logging
log_level = logging.WARNING log_level = logging.WARNING
match TOML['options']['log_level'].upper():
case 'DEBUG': # log level as an uppercase string from config
ll_str = TOML['options']['log_level'].upper()
if ll_str == "DEBUG":
log_level = logging.DEBUG log_level = logging.DEBUG
case 'INFO': elif ll_str == "INFO":
log_level = logging.INFO log_level = logging.INFO
case 'WARNING': elif ll_str == "WARNING":
log_level = logging.WARNING log_level = logging.WARNING
case 'ERROR': elif ll_str == "ERROR":
log_level = logging.ERROR log_level = logging.ERROR
case 'CRITICAL': elif ll_str == "CRITICAL":
log_level = logging.CRITICAL log_level == logging.CRITICAL
case 'OFF': elif ll_str == "OFF":
# Disable all logging # Disable all logging
logging.disable(logging.CRITICAL) logging.disable(logging.CRITICAL)
case _: else:
logging.error('Invalid log_level %s in config file. Using WARNING.', str(TOML['options']['log_level'])) logging.error('Invalid log_level %s in config file. Using WARNING.', str(TOML['options']['log_level']))
# Set desired level of logging
logger = logging.getLogger() logger = logging.getLogger()
logger.setLevel(log_level) logger.setLevel(log_level)