From: Roland Häder Date: Sun, 21 May 2023 09:56:32 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=6c74729cfcd2468fe7d2d7f111641878fe080bf7;p=fba.git Continued: - make all software names lower-case - also include initial instance --- diff --git a/fba.py b/fba.py index c4e23b2..0d467b0 100644 --- a/fba.py +++ b/fba.py @@ -167,7 +167,7 @@ def determine_software(domain: str) -> str: software = "misskey" else: # NOISY-DEBUG: print("DEBUG: Using name:", domain, json["software"]["name"]) - software = json["software"]["name"] + software = json["software"]["name"].lower() except: print("WARNING: Could not determine software type:", domain) diff --git a/fetch_instances.py b/fetch_instances.py index 8a4a45c..3a27338 100644 --- a/fetch_instances.py +++ b/fetch_instances.py @@ -10,18 +10,17 @@ def fetch_instances(domain: str, origin: str): if (peerlist is None): print("ERROR: Cannot fetch peers:", domain) + return - fba.c.execute( - "SELECT domain FROM instances WHERE domain = ? LIMIT 1", [domain] - ) - - if fba.c.fetchone() == None: - # NOISY-DEBUG: print("DEBUG: Adding new domain:", domain, origin) - fba.add_instance(domain, origin, sys.argv[0]) + fba.c.execute( + "SELECT domain FROM instances WHERE domain = ? LIMIT 1", [domain] + ) - fba.conn.commit() - return + if fba.c.fetchone() == None: + # NOISY-DEBUG: print("DEBUG: Adding new domain:", domain, origin) + fba.add_instance(domain, origin, sys.argv[0]) + print(f"INFO: Checking {len(peerlist)} instances from {domain} ...") for instance in peerlist: instance = instance.lower() if instance.find("@") > 0: