feat(sde): Add a JSON list of all published ship types (#41)

This commit is contained in:
Steven Noorbergen
2024-05-05 15:48:29 +02:00
committed by GitHub
parent 626b9f64df
commit 38b56b4cff
2 changed files with 36 additions and 0 deletions

View File

@@ -57,6 +57,7 @@ jobs:
run: |
protoc --python_out=. esf.proto
python convert.py sde/fsd
python list_shiptypes.py sde/fsd
- name: Fetch icons
run: |

35
list_shiptypes.py Normal file
View File

@@ -0,0 +1,35 @@
import json
import os
import sys
import yaml
if len(sys.argv) < 2:
print("Usage: python3 convert.py <path/to/eve-sde/fsd>")
exit(1)
path = sys.argv[1]
os.makedirs("dist", exist_ok=True)
with open(f"{path}/groupIDs.yaml") as fp:
groupIDs = yaml.load(fp, Loader=yaml.CSafeLoader)
with open(f"{path}/typeIDs.yaml") as fp:
typeIDs = yaml.load(fp, Loader=yaml.CSafeLoader)
ships = []
for id, entry in typeIDs.items():
group = groupIDs[entry["groupID"]]
if group["categoryID"] == 6 and entry["published"]:
ships.append(
{
"id": id,
"name": entry["name"]["en"],
"group": group["name"]["en"],
}
)
with open("dist/shiptypes.json", "w") as fp:
json.dump(ships, fp)