From 700a5955e786f3397c42f079015665369960e6a5 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Fri, 23 Oct 2020 17:38:27 -0400 Subject: [PATCH] fix null modes error --- gen_stats | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gen_stats b/gen_stats index eda2ceb..74a699a 100755 --- a/gen_stats +++ b/gen_stats @@ -38,10 +38,12 @@ out["channels"] = [] for c in root.findall("./channellist/channel"): name = unsanitize(c.find("channelname")) + modes = c.find("./channelmodes").text if ( # skip channels in the blacklist or with mode +s - "s" in c.find("./channelmodes").text.split()[0] - or name in BLACKLIST + name in BLACKLIST + or modes is None + or "s" in modes.split()[0] ): continue @@ -54,7 +56,6 @@ for c in root.findall("./channellist/channel"): ) ) - out["channels"].sort(key=lambda x: x["name"].lower()) with open(f"{WORK_DIR}/stats.json", "w") as f: