From 6c74729cfcd2468fe7d2d7f111641878fe080bf7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sun, 21 May 2023 11:56:32 +0200 Subject: [PATCH] Continued: - make all software names lower-case - also include initial instance --- fba.py | 2 +- fetch_instances.py | 17 ++++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) 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: -- 2.39.5