mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-18 18:20:39 +08:00
33 lines
972 B
Python
33 lines
972 B
Python
import json
|
|
from pathlib import Path
|
|
from collections import OrderedDict
|
|
|
|
path = str(Path(__file__).parents[2]) + "/"
|
|
|
|
servers = {
|
|
"EN": "YoStarEN",
|
|
"JP": "YoStarJP",
|
|
"KR": "YoStarKR",
|
|
"TW": "txwy"
|
|
}
|
|
|
|
with open(path + "resource/tasks.json", "r", encoding="UTF-8") as file:
|
|
order = list(json.load(file).keys())
|
|
print("CN:", str(len(order)).rjust(4, " "), "tasks")
|
|
|
|
for server, name in servers.items():
|
|
with open(
|
|
path + f"resource/global/{name}/resource/tasks.json", "r", encoding="UTF-8"
|
|
) as file:
|
|
tasks = json.load(file)
|
|
tasks = OrderedDict(
|
|
sorted(
|
|
tasks.items(),
|
|
key=lambda item: order.index(item[0]) if item[0] in order else -1,
|
|
)
|
|
)
|
|
with open(
|
|
path + f"resource/global/{name}/resource/tasks.json", "w", encoding="UTF-8"
|
|
) as file:
|
|
json.dump(tasks, file, indent=4, ensure_ascii=False)
|
|
print(server + ":", str(len(tasks)).rjust(4, " "), "tasks") |