make threads subdir under board so we can put an index.json there with board metadata

This commit is contained in:
Adrian Malacoda 2016-11-26 23:54:05 -06:00
parent eabf099f47
commit 6fb7980218

View File

@ -13,6 +13,10 @@ def output (data, destination):
def output_forum (data, destination):
os.makedirs(destination)
with open(os.path.join(destination, "index.json"), "w") as out_file:
out_file.write(json.dumps({title: data.title}, indent=4))
for category in data.categories:
os.makedirs(os.path.join(destination, category.title))
for board in category.children:
@ -20,8 +24,12 @@ def output_forum (data, destination):
def output_board (data, destination):
os.makedirs(destination)
os.makedirs(os.path.join(destination, "threads"))
with open(os.path.join(destination, "index.json"), "w") as out_file:
out_file.write(json.dumps({"title": data.title}, indent=4))
for thread in data.children:
output_thread(thread, os.path.join(destination, thread.title))
output_thread(thread, os.path.join(destination, "threads", thread.title))
def output_thread (data, destination):
with open(destination, "w") as out_file: