Skip to content

Commit

Permalink
ci: add job auto update script
Browse files Browse the repository at this point in the history
  • Loading branch information
StarHeartHunt committed Dec 5, 2024
1 parent 8d5fb3c commit febde73
Show file tree
Hide file tree
Showing 2 changed files with 166 additions and 123 deletions.
252 changes: 129 additions & 123 deletions RouletteRecorder/data/job.json
Original file line number Diff line number Diff line change
@@ -1,125 +1,131 @@
{
"0": {
"name": "冒险者"
},
"1": {
"name": "剑术师"
},
"2": {
"name": "格斗家"
},
"3": {
"name": "斧术师"
},
"4": {
"name": "枪术师"
},
"5": {
"name": "弓箭手"
},
"6": {
"name": "幻术师"
},
"7": {
"name": "咒术师"
},
"8": {
"name": "刻木匠"
},
"9": {
"name": "锻铁匠"
},
"10": {
"name": "铸甲匠"
},
"11": {
"name": "雕金匠"
},
"12": {
"name": "制革匠"
},
"13": {
"name": "裁衣匠"
},
"14": {
"name": "炼金术士"
},
"15": {
"name": "烹调师"
},
"16": {
"name": "采矿工"
},
"17": {
"name": "园艺工"
},
"18": {
"name": "捕鱼人"
},
"19": {
"name": "骑士"
},
"20": {
"name": "武僧"
},
"21": {
"name": "战士"
},
"22": {
"name": "龙骑士"
},
"23": {
"name": "吟游诗人"
},
"24": {
"name": "白魔法师"
},
"25": {
"name": "黑魔法师"
},
"26": {
"name": "秘术师"
},
"27": {
"name": "召唤师"
},
"28": {
"name": "学者"
},
"29": {
"name": "双剑师"
},
"30": {
"name": "忍者"
},
"31": {
"name": "机工士"
},
"32": {
"name": "暗黑骑士"
},
"33": {
"name": "占星术士"
},
"34": {
"name": "武士"
},
"35": {
"name": "赤魔法师"
},
"36": {
"name": "青魔法师"
},
"37": {
"name": "绝枪战士"
},
"38": {
"name": "舞者"
},
"39": {
"name": "钐镰客"
},
"40": {
"name": "贤者"
}
"0": {
"name": "冒险者"
},
"1": {
"name": "剑术师"
},
"2": {
"name": "格斗家"
},
"3": {
"name": "斧术师"
},
"4": {
"name": "枪术师"
},
"5": {
"name": "弓箭手"
},
"6": {
"name": "幻术师"
},
"7": {
"name": "咒术师"
},
"8": {
"name": "刻木匠"
},
"9": {
"name": "锻铁匠"
},
"10": {
"name": "铸甲匠"
},
"11": {
"name": "雕金匠"
},
"12": {
"name": "制革匠"
},
"13": {
"name": "裁衣匠"
},
"14": {
"name": "炼金术士"
},
"15": {
"name": "烹调师"
},
"16": {
"name": "采矿工"
},
"17": {
"name": "园艺工"
},
"18": {
"name": "捕鱼人"
},
"19": {
"name": "骑士"
},
"20": {
"name": "武僧"
},
"21": {
"name": "战士"
},
"22": {
"name": "龙骑士"
},
"23": {
"name": "吟游诗人"
},
"24": {
"name": "白魔法师"
},
"25": {
"name": "黑魔法师"
},
"26": {
"name": "秘术师"
},
"27": {
"name": "召唤师"
},
"28": {
"name": "学者"
},
"29": {
"name": "双剑师"
},
"30": {
"name": "忍者"
},
"31": {
"name": "机工士"
},
"32": {
"name": "暗黑骑士"
},
"33": {
"name": "占星术士"
},
"34": {
"name": "武士"
},
"35": {
"name": "赤魔法师"
},
"36": {
"name": "青魔法师"
},
"37": {
"name": "绝枪战士"
},
"38": {
"name": "舞者"
},
"39": {
"name": "钐镰客"
},
"40": {
"name": "贤者"
},
"41": {
"name": "蝰蛇剑士"
},
"42": {
"name": "绘灵法师"
}
}
37 changes: 37 additions & 0 deletions scripts/extract_job.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import csv
import json
from pathlib import Path

import httpx
from utils import extract_header

client = httpx.Client()

if __name__ == "__main__":
data = {}

dest = Path(__file__).parent / "data" / "ClassJob.csv"
dest.write_bytes(
client.get(
"https://raw.githubusercontent.com/thewakingsands/ffxiv-datamining-cn/refs/heads/master/ClassJob.csv"
).read()
)

with open(dest.resolve(), encoding="utf-8") as f:
headers = extract_header(f)
reader = csv.DictReader(f, fieldnames=headers)
for row in reader:
id_ = int(row["Key"])

if not data.get(id_):
if row["Name"]:
data[id_] = {
"name": row["Name"],
}
else:
print(f"Skipping {id_}")

continue

dest = Path(__file__).parent.parent.joinpath("RouletteRecorder", "data", "job.json")
dest.write_text(json.dumps(data, ensure_ascii=False, indent=2), encoding="utf-8")

0 comments on commit febde73

Please sign in to comment.