diff --git a/config/passager_dream_in_a_moment.yaml b/config/passager_dream_in_a_moment.yaml index 062d15f..ab483f7 100644 --- a/config/passager_dream_in_a_moment.yaml +++ b/config/passager_dream_in_a_moment.yaml @@ -16,6 +16,6 @@ index.html: title: 'Arknights: Dream in a Moment / Passager - 明日方舟:今昔须臾之梦 · 异客' version: ${func:get_version()} project.json: !include config/_project.json.yaml -link: ling +link: passager_dream_in_a_moment type: skin date: 2022/11 \ No newline at end of file diff --git a/lib/builder.py b/lib/builder.py index 080d6a3..7d5c00e 100644 --- a/lib/builder.py +++ b/lib/builder.py @@ -1,5 +1,7 @@ from multiprocessing import Process, Manager import shutil +import json +import operator from lib.alpha_composite import AlphaComposite from lib.atlas_reader import AtlasReader from lib.base64_util import * @@ -267,4 +269,17 @@ class Builder: file_path ) + # generate a directory.json for index page + save_path = pathlib.Path.cwd().joinpath(target_path, "directory.json") + directory_json = [] + for key, value in self.config["operators"].items(): + directory_json.append(dict( + name=key, + link=value["link"], + type=value["type"], + date=value["date"] + )) + directory_json.sort(key=operator.itemgetter("date", "name"), reverse=True) + with open(save_path, 'w', encoding='utf8') as fp: + json.dump(directory_json, fp) return