From 2747dfa3d2b3fe4cc72644835fba7b14e2028f49 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Shelton" Date: Tue, 22 Sep 2026 13:57:45 -0600 Subject: [PATCH] Updated dump template. This will eventually be converted into a proper utility at some point. --- utils/dump.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/utils/dump.py b/utils/dump.py index 6627078..dab5507 100644 --- a/utils/dump.py +++ b/utils/dump.py @@ -1,5 +1,5 @@ -d = json.loads(open("complete.json").read()) +d = json.loads(open("../bsb.json").read()) with open("meta.json", "wb") as fp: fp.write(json.dumps(d["translation"]).encode("utf8")) @@ -10,14 +10,15 @@ for book in b: ch = 1 basepath = os.path.abspath(os.path.join(".", book["id"])) if not os.path.exists(basepath): - os.mkdir(basepath, True) + os.makedirs(basepath, exist_ok=True) with open(os.path.join(basepath, "meta.json"), "wb") as fp: fp.write(json.dumps({k: v for k, v in book.items() if k != "chapters"}).encode("utf8")) for chapter in book["chapters"]: if not os.path.exists(os.path.join(basepath, str(ch))): - os.mkdir(os.path.join(basepath, str(ch)), True) + os.makedirs(os.path.join(basepath, str(ch)), exist_ok=True) with open(os.path.join(basepath, str(ch), "chapter.json"), "wb") as fp: fp.write(json.dumps({k: v for k, v in chapter.items()}).encode("utf8")) + ch += 1 alias_map = {