feat(builder): generate a directory.json for index page
This commit is contained in:
@@ -16,6 +16,6 @@ index.html:
|
|||||||
title: 'Arknights: Dream in a Moment / Passager - 明日方舟:今昔须臾之梦 · 异客'
|
title: 'Arknights: Dream in a Moment / Passager - 明日方舟:今昔须臾之梦 · 异客'
|
||||||
version: ${func:get_version()}
|
version: ${func:get_version()}
|
||||||
project.json: !include config/_project.json.yaml
|
project.json: !include config/_project.json.yaml
|
||||||
link: ling
|
link: passager_dream_in_a_moment
|
||||||
type: skin
|
type: skin
|
||||||
date: 2022/11
|
date: 2022/11
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
from multiprocessing import Process, Manager
|
from multiprocessing import Process, Manager
|
||||||
import shutil
|
import shutil
|
||||||
|
import json
|
||||||
|
import operator
|
||||||
from lib.alpha_composite import AlphaComposite
|
from lib.alpha_composite import AlphaComposite
|
||||||
from lib.atlas_reader import AtlasReader
|
from lib.atlas_reader import AtlasReader
|
||||||
from lib.base64_util import *
|
from lib.base64_util import *
|
||||||
@@ -267,4 +269,17 @@ class Builder:
|
|||||||
file_path
|
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
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user