From: Roland Häder Date: Mon, 12 Feb 2024 15:45:46 +0000 (+0100) Subject: Continued: X-Git-Url: https://git.mxchange.org/?p=fba.git;a=commitdiff_plain;h=839317d17e71f354515ec1c28498162cfb9c159b Continued: - check parameters first, then "expensive" function invocation's returned value - command fetch_instances should always fetch instances from a provided domain name - only when --software=bar is used and no --force parameter was given --- diff --git a/fba/boot.py b/fba/boot.py index 0fb55ec..f0a109b 100644 --- a/fba/boot.py +++ b/fba/boot.py @@ -145,8 +145,9 @@ def init_parser(): ) parser.set_defaults(command=commands.fetch_instances) parser.add_argument("--domain", help="Instance name (aka. domain) to fetch further instances from. Start with a large instance, e.g. mastodon.social .") - parser.add_argument("--software", help="Name of software, e.g. 'lemmy'") + parser.add_argument("--force", action="store_true", help="Include also already existing instances, otherwise only new are checked") parser.add_argument("--single", action="store_true", help="Only fetch given instance.") + parser.add_argument("--software", help="Name of software, e.g. 'lemmy'") ### Fetch blocks from static text file(s) ### parser = subparser_command.add_parser( diff --git a/fba/commands.py b/fba/commands.py index 6999e2a..9dcbd41 100644 --- a/fba/commands.py +++ b/fba/commands.py @@ -996,7 +996,7 @@ def fetch_instances(args: argparse.Namespace) -> int: elif instances.is_registered(row["domain"]) and software_helper.is_relay(row["software"]): logger.warning("row[domain]='%s' is of software type '%s' which is not supported by this command. Please invoke fetch_relays instead - SKIPPED!", row["domain"], row["software"]) continue - elif instances.is_recent(row["domain"]): + elif not args.force and not args.software in [None, ""]and instances.is_recent(row["domain"]): logger.debug("row[domain]='%s' has been recently crawled - SKIPPED!", row["domain"]) continue