From c2fc0237fe2fa0ec625227a773030f07f8975754 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Sat, 16 Mar 2019 14:59:02 -0400 Subject: [PATCH] fix filepaths --- gen_stats | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gen_stats b/gen_stats index a53ce1b..00b3cf0 100755 --- a/gen_stats +++ b/gen_stats @@ -2,13 +2,14 @@ import requests, json import xml.etree.ElementTree as xml +WORK_DIR = "/var/www/tilde.chat" r = requests.get("http://localhost:8081/stats") r.raise_for_status() out = {} d = xml.fromstring(r.text) assert d.tag == "inspircdstats" -with open("blacklist", "r") as f: +with open(f"{WORK_DIR}/blacklist", "r") as f: BLACKLIST = f.read().splitlines() def define(name, xps, vfilter=lambda x: x): @@ -49,5 +50,5 @@ channels.sort(key=lambda x: x["name"].lower()) out["channels"] = channels # print([x.text for x in d.findall("./channellist/channel/channeltopic/topictext")]) -with open("/var/www/tilde.chat/stats.json", "w") as f: +with open(f"{WORK_DIR}/stats.json", "w") as f: json.dump(out, f)