Compare commits

...

4 Commits

Author SHA1 Message Date
GitHub Action
f84a5282db chore: update idJson to 2.3.0 2025-10-06 07:01:24 +00:00
66acb3e4dc ci: fix GH_TOKEN 2025-10-06 14:59:36 +08:00
b10a11b177 ci: fix can't trigger release 2025-10-06 14:50:03 +08:00
db587f3537 ci: update script and add workflow 2025-10-06 14:38:55 +08:00
5 changed files with 562 additions and 23 deletions

91
.github/workflows/idmap.yml vendored Normal file
View File

@@ -0,0 +1,91 @@
name: Update ID Map and Version
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
update-idmap:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GH_TOKEN }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install requests opencc
- name: Run getIdMap.py
run: |
python tools/getIdMap.py
- name: Check if idJson.json changed
id: check_changes
run: |
git add -A
if git diff --staged --quiet -- src/idJson.json; then
echo "changes=false" >> $GITHUB_OUTPUT
echo "No changes detected in src/idJson.json"
else
echo "changes=true" >> $GITHUB_OUTPUT
echo "Changes detected in src/idJson.json"
fi
- name: Get current version from idJson
if: steps.check_changes.outputs.changes == 'true'
id: get_version
run: |
VERSION=$(python -c "import json; print(json.load(open('src/idJson.json', encoding='utf-8'))['version'])")
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Current version in idJson: $VERSION"
- name: Bump package.json version
if: steps.check_changes.outputs.changes == 'true'
id: bump_version
run: |
CURRENT_VERSION=$(node -p "require('./package.json').version")
echo "Current package.json version: $CURRENT_VERSION"
IFS='.' read -ra VERSION_PARTS <<< "$CURRENT_VERSION"
MAJOR=${VERSION_PARTS[0]}
MINOR=${VERSION_PARTS[1]}
PATCH=${VERSION_PARTS[2]}
NEW_PATCH=$((PATCH + 1))
NEW_VERSION="$MAJOR.$MINOR.$NEW_PATCH"
echo "New package.json version: $NEW_VERSION"
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
node -e "
const fs = require('fs');
const packageJson = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
packageJson.version = '$NEW_VERSION';
fs.writeFileSync('./package.json', JSON.stringify(packageJson, null, 2) + '\n');
"
- name: Create and push tag
if: steps.check_changes.outputs.changes == 'true'
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add src/idJson.json package.json
git commit -m "chore: update idJson to ${{ steps.get_version.outputs.version }}"
TAG_NAME="v${{ steps.bump_version.outputs.new_version }}"
git tag $TAG_NAME
git push
git push origin $TAG_NAME
echo "Created and pushed tag: $TAG_NAME"

View File

@@ -28,7 +28,7 @@ jobs:
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ZzzSignalSearchExport ${{ github.ref }}
@@ -39,7 +39,7 @@ jobs:
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./build/app.zip
@@ -52,4 +52,4 @@ jobs:
commit_message: Update app
build_dir: ./build/update
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}

View File

@@ -1,6 +1,6 @@
{
"name": "zzz-signal-search-export",
"version": "1.1.12",
"version": "1.1.13",
"autoUpdateActive": true,
"autoUpdateFrom": "1.1.0",
"main": "./dist/electron/main/main.js",

View File

@@ -90,6 +90,16 @@
"item_type": "音擎",
"rank_type": 3
},
"14130": {
"name": "嚣枪喧焰",
"item_type": "音擎",
"rank_type": 4
},
"14105": {
"name": "伊德海莉测试音擎",
"item_type": "音擎",
"rank_type": 4
},
"13010": {
"name": "兔能环",
"item_type": "音擎",
@@ -150,11 +160,21 @@
"item_type": "音擎",
"rank_type": 4
},
"14145": {
"name": "铸梦炉歌",
"item_type": "音擎",
"rank_type": 4
},
"14138": {
"name": "牺牲洁纯",
"item_type": "音擎",
"rank_type": 4
},
"14146": {
"name": "机巧心种",
"item_type": "音擎",
"rank_type": 4
},
"14136": {
"name": "索魂影眸",
"item_type": "音擎",
@@ -205,6 +225,11 @@
"item_type": "音擎",
"rank_type": 4
},
"14141": {
"name": "狸法七变化",
"item_type": "音擎",
"rank_type": 4
},
"13101": {
"name": "德玛拉电池Ⅱ型",
"item_type": "音擎",
@@ -285,6 +310,11 @@
"item_type": "音擎",
"rank_type": 3
},
"14140": {
"name": "十方锻星",
"item_type": "音擎",
"rank_type": 4
},
"13013": {
"name": "鎏金花信",
"item_type": "音擎",
@@ -345,6 +375,11 @@
"item_type": "音擎",
"rank_type": 3
},
"13144": {
"name": "野良野测试音擎",
"item_type": "音擎",
"rank_type": 3
},
"13128": {
"name": "轰鸣座驾",
"item_type": "音擎",
@@ -405,6 +440,11 @@
"item_type": "代理人",
"rank_type": 4
},
"1401": {
"name": "爱丽丝",
"item_type": "代理人",
"rank_type": 4
},
"1011": {
"name": "安比",
"item_type": "代理人",
@@ -450,6 +490,11 @@
"item_type": "代理人",
"rank_type": 4
},
"1461": {
"name": "「席德」",
"item_type": "代理人",
"rank_type": 4
},
"1111": {
"name": "安东",
"item_type": "代理人",
@@ -460,6 +505,11 @@
"item_type": "代理人",
"rank_type": 4
},
"1451": {
"name": "(Test1)卢西娅",
"item_type": "代理人",
"rank_type": 4
},
"1091": {
"name": "雅",
"item_type": "代理人",
@@ -480,6 +530,16 @@
"item_type": "代理人",
"rank_type": 4
},
"1051": {
"name": "伊德海莉",
"item_type": "代理人",
"rank_type": 4
},
"1411": {
"name": "柚叶",
"item_type": "代理人",
"rank_type": 4
},
"1291": {
"name": "雨果",
"item_type": "代理人",
@@ -495,6 +555,16 @@
"item_type": "代理人",
"rank_type": 4
},
"1301": {
"name": "奥菲丝&「鬼火」",
"item_type": "代理人",
"rank_type": 4
},
"1441": {
"name": "狛野真斗",
"item_type": "代理人",
"rank_type": 3
},
"1151": {
"name": "露西",
"item_type": "代理人",
@@ -565,11 +635,21 @@
"item_type": "邦布",
"rank_type": 3
},
"54018": {
"name": "艾丝弥小姐",
"item_type": "邦布",
"rank_type": 4
},
"54015": {
"name": "咔嚓仔",
"item_type": "邦布",
"rank_type": 4
},
"53016": {
"name": "圣剑布",
"item_type": "邦布",
"rank_type": 3
},
"54016": {
"name": "罗宾",
"item_type": "邦布",
@@ -625,6 +705,11 @@
"item_type": "邦布",
"rank_type": 3
},
"54019": {
"name": "「墨丘利」",
"item_type": "邦布",
"rank_type": 4
},
"54017": {
"name": "狮耶",
"item_type": "邦布",
@@ -777,6 +862,16 @@
"item_type": "音擎",
"rank_type": 3
},
"14130": {
"name": "囂槍喧焰",
"item_type": "音擎",
"rank_type": 4
},
"14105": {
"name": "伊德海莉測試音擎",
"item_type": "音擎",
"rank_type": 4
},
"13010": {
"name": "兔能環",
"item_type": "音擎",
@@ -837,11 +932,21 @@
"item_type": "音擎",
"rank_type": 4
},
"14145": {
"name": "鑄夢爐歌",
"item_type": "音擎",
"rank_type": 4
},
"14138": {
"name": "犧牲潔純",
"item_type": "音擎",
"rank_type": 4
},
"14146": {
"name": "機巧心種",
"item_type": "音擎",
"rank_type": 4
},
"14136": {
"name": "索魂影眸",
"item_type": "音擎",
@@ -892,6 +997,11 @@
"item_type": "音擎",
"rank_type": 4
},
"14141": {
"name": "狸法七變化",
"item_type": "音擎",
"rank_type": 4
},
"13101": {
"name": "德瑪拉電池Ⅱ型",
"item_type": "音擎",
@@ -972,6 +1082,11 @@
"item_type": "音擎",
"rank_type": 3
},
"14140": {
"name": "十方鍛星",
"item_type": "音擎",
"rank_type": 4
},
"13013": {
"name": "鎏金花信",
"item_type": "音擎",
@@ -1032,6 +1147,11 @@
"item_type": "音擎",
"rank_type": 3
},
"13144": {
"name": "野良野測試音擎",
"item_type": "音擎",
"rank_type": 3
},
"13128": {
"name": "轟鳴座駕",
"item_type": "音擎",
@@ -1092,6 +1212,11 @@
"item_type": "代理人",
"rank_type": 4
},
"1401": {
"name": "愛麗絲",
"item_type": "代理人",
"rank_type": 4
},
"1011": {
"name": "安比",
"item_type": "代理人",
@@ -1137,6 +1262,11 @@
"item_type": "代理人",
"rank_type": 4
},
"1461": {
"name": "「席德」",
"item_type": "代理人",
"rank_type": 4
},
"1111": {
"name": "安東",
"item_type": "代理人",
@@ -1147,6 +1277,11 @@
"item_type": "代理人",
"rank_type": 4
},
"1451": {
"name": "(Test1)盧西婭",
"item_type": "代理人",
"rank_type": 4
},
"1091": {
"name": "雅",
"item_type": "代理人",
@@ -1167,6 +1302,16 @@
"item_type": "代理人",
"rank_type": 4
},
"1051": {
"name": "伊德海莉",
"item_type": "代理人",
"rank_type": 4
},
"1411": {
"name": "柚葉",
"item_type": "代理人",
"rank_type": 4
},
"1291": {
"name": "雨果",
"item_type": "代理人",
@@ -1182,6 +1327,16 @@
"item_type": "代理人",
"rank_type": 4
},
"1301": {
"name": "奧菲絲&「鬼火」",
"item_type": "代理人",
"rank_type": 4
},
"1441": {
"name": "狛野真鬥",
"item_type": "代理人",
"rank_type": 3
},
"1151": {
"name": "露西",
"item_type": "代理人",
@@ -1252,11 +1407,21 @@
"item_type": "邦布",
"rank_type": 3
},
"54018": {
"name": "艾絲彌小姐",
"item_type": "邦布",
"rank_type": 4
},
"54015": {
"name": "咔嚓仔",
"item_type": "邦布",
"rank_type": 4
},
"53016": {
"name": "聖劍布",
"item_type": "邦布",
"rank_type": 3
},
"54016": {
"name": "羅賓",
"item_type": "邦布",
@@ -1312,6 +1477,11 @@
"item_type": "邦布",
"rank_type": 3
},
"54019": {
"name": "「墨丘利」",
"item_type": "邦布",
"rank_type": 4
},
"54017": {
"name": "獅耶",
"item_type": "邦布",
@@ -1464,6 +1634,16 @@
"item_type": "W-Engines",
"rank_type": 3
},
"14130": {
"name": "Bellicose Blaze",
"item_type": "W-Engines",
"rank_type": 4
},
"14105": {
"name": "Yidhari W-Engine Test",
"item_type": "W-Engines",
"rank_type": 4
},
"13010": {
"name": "Bunny Band",
"item_type": "W-Engines",
@@ -1524,11 +1704,21 @@
"item_type": "W-Engines",
"rank_type": 4
},
"14145": {
"name": "Dreamlit Hearth",
"item_type": "W-Engines",
"rank_type": 4
},
"14138": {
"name": "Severed Innocence",
"item_type": "W-Engines",
"rank_type": 4
},
"14146": {
"name": "Cordis Germina",
"item_type": "W-Engines",
"rank_type": 4
},
"14136": {
"name": "Spectral Gaze",
"item_type": "W-Engines",
@@ -1579,6 +1769,11 @@
"item_type": "W-Engines",
"rank_type": 4
},
"14141": {
"name": "Metanukimorphosis",
"item_type": "W-Engines",
"rank_type": 4
},
"13101": {
"name": "Demara Battery Mark II",
"item_type": "W-Engines",
@@ -1659,6 +1854,11 @@
"item_type": "W-Engines",
"rank_type": 3
},
"14140": {
"name": "Practiced Perfection",
"item_type": "W-Engines",
"rank_type": 4
},
"13013": {
"name": "Gilded Blossom",
"item_type": "W-Engines",
@@ -1719,6 +1919,11 @@
"item_type": "W-Engines",
"rank_type": 3
},
"13144": {
"name": "Wild Field W-Engine Test",
"item_type": "W-Engines",
"rank_type": 3
},
"13128": {
"name": "Roaring Ride",
"item_type": "W-Engines",
@@ -1779,6 +1984,11 @@
"item_type": "Agents",
"rank_type": 4
},
"1401": {
"name": "Alice",
"item_type": "Agents",
"rank_type": 4
},
"1011": {
"name": "Anby",
"item_type": "Agents",
@@ -1824,6 +2034,11 @@
"item_type": "Agents",
"rank_type": 4
},
"1461": {
"name": "Seed",
"item_type": "Agents",
"rank_type": 4
},
"1111": {
"name": "Anton",
"item_type": "Agents",
@@ -1834,6 +2049,11 @@
"item_type": "Agents",
"rank_type": 4
},
"1451": {
"name": "Avatar_Female_Size02_Lucia",
"item_type": "Agents",
"rank_type": 4
},
"1091": {
"name": "Miyabi",
"item_type": "Agents",
@@ -1854,6 +2074,16 @@
"item_type": "Agents",
"rank_type": 4
},
"1051": {
"name": "Yidhari",
"item_type": "Agents",
"rank_type": 4
},
"1411": {
"name": "Yuzuha",
"item_type": "Agents",
"rank_type": 4
},
"1291": {
"name": "Hugo",
"item_type": "Agents",
@@ -1869,6 +2099,16 @@
"item_type": "Agents",
"rank_type": 4
},
"1301": {
"name": "Orphie & Magus",
"item_type": "Agents",
"rank_type": 4
},
"1441": {
"name": "Komano Manato",
"item_type": "Agents",
"rank_type": 3
},
"1151": {
"name": "Lucy",
"item_type": "Agents",
@@ -1939,11 +2179,21 @@
"item_type": "Bangboo",
"rank_type": 3
},
"54018": {
"name": "Miss Esme",
"item_type": "Bangboo",
"rank_type": 4
},
"54015": {
"name": "Snap",
"item_type": "Bangboo",
"rank_type": 4
},
"53016": {
"name": "Excaliboo",
"item_type": "Bangboo",
"rank_type": 3
},
"54016": {
"name": "Robin",
"item_type": "Bangboo",
@@ -1999,6 +2249,11 @@
"item_type": "Bangboo",
"rank_type": 3
},
"54019": {
"name": "Mercury",
"item_type": "Bangboo",
"rank_type": 4
},
"54017": {
"name": "Belion",
"item_type": "Bangboo",
@@ -2151,6 +2406,16 @@
"item_type": "音動機",
"rank_type": 3
},
"14130": {
"name": "憤怒の銃騒",
"item_type": "音動機",
"rank_type": 4
},
"14105": {
"name": "イドリーは音動機をテストする",
"item_type": "音動機",
"rank_type": 4
},
"13010": {
"name": "ラビットチャージャー",
"item_type": "音動機",
@@ -2211,11 +2476,21 @@
"item_type": "音動機",
"rank_type": 4
},
"14145": {
"name": "炉で歌い上げられる夢",
"item_type": "音動機",
"rank_type": 4
},
"14138": {
"name": "純然たる犠牲",
"item_type": "音動機",
"rank_type": 4
},
"14146": {
"name": "駆動する種",
"item_type": "音動機",
"rank_type": 4
},
"14136": {
"name": "奪魂の瞑目",
"item_type": "音動機",
@@ -2266,6 +2541,11 @@
"item_type": "音動機",
"rank_type": 4
},
"14141": {
"name": "狸の七変化",
"item_type": "音動機",
"rank_type": 4
},
"13101": {
"name": "デマラ式電池Ⅱ型",
"item_type": "音動機",
@@ -2346,6 +2626,11 @@
"item_type": "音動機",
"rank_type": 3
},
"14140": {
"name": "十面百錬の星",
"item_type": "音動機",
"rank_type": 4
},
"13013": {
"name": "金メッキの花信",
"item_type": "音動機",
@@ -2406,6 +2691,11 @@
"item_type": "音動機",
"rank_type": 3
},
"13144": {
"name": "野良野テスト音動機",
"item_type": "音動機",
"rank_type": 3
},
"13128": {
"name": "グロウル・マイ・カー",
"item_type": "音動機",
@@ -2466,6 +2756,11 @@
"item_type": "エージェント",
"rank_type": 4
},
"1401": {
"name": "アリス",
"item_type": "エージェント",
"rank_type": 4
},
"1011": {
"name": "アンビー",
"item_type": "エージェント",
@@ -2511,6 +2806,11 @@
"item_type": "エージェント",
"rank_type": 4
},
"1461": {
"name": "「シード」",
"item_type": "エージェント",
"rank_type": 4
},
"1111": {
"name": "アンドー",
"item_type": "エージェント",
@@ -2521,6 +2821,11 @@
"item_type": "エージェント",
"rank_type": 4
},
"1451": {
"name": "Avatar_Female_Size02_Lucia",
"item_type": "エージェント",
"rank_type": 4
},
"1091": {
"name": "星見雅",
"item_type": "エージェント",
@@ -2541,6 +2846,16 @@
"item_type": "エージェント",
"rank_type": 4
},
"1051": {
"name": "イドリー",
"item_type": "エージェント",
"rank_type": 4
},
"1411": {
"name": "浮波柚葉",
"item_type": "エージェント",
"rank_type": 4
},
"1291": {
"name": "ヒューゴ",
"item_type": "エージェント",
@@ -2556,6 +2871,16 @@
"item_type": "エージェント",
"rank_type": 4
},
"1301": {
"name": "オルペウス&「鬼火」",
"item_type": "エージェント",
"rank_type": 4
},
"1441": {
"name": "狛野真斗",
"item_type": "エージェント",
"rank_type": 3
},
"1151": {
"name": "ルーシー",
"item_type": "エージェント",
@@ -2626,11 +2951,21 @@
"item_type": "ボンプ",
"rank_type": 3
},
"54018": {
"name": "ミス・エスメ",
"item_type": "ボンプ",
"rank_type": 4
},
"54015": {
"name": "カチャコ",
"item_type": "ボンプ",
"rank_type": 4
},
"53016": {
"name": "セイケンボンプ",
"item_type": "ボンプ",
"rank_type": 3
},
"54016": {
"name": "ロビン",
"item_type": "ボンプ",
@@ -2686,6 +3021,11 @@
"item_type": "ボンプ",
"rank_type": 3
},
"54019": {
"name": "「マーキュリー」",
"item_type": "ボンプ",
"rank_type": 4
},
"54017": {
"name": "オシシ",
"item_type": "ボンプ",
@@ -2838,6 +3178,16 @@
"item_type": "W-엔진",
"rank_type": 3
},
"14130": {
"name": "소란한 총성과 화염",
"item_type": "W-엔진",
"rank_type": 4
},
"14105": {
"name": "Item_Weapon_S_1051_Name",
"item_type": "W-엔진",
"rank_type": 4
},
"13010": {
"name": "버니 밴드",
"item_type": "W-엔진",
@@ -2898,11 +3248,21 @@
"item_type": "W-엔진",
"rank_type": 4
},
"14145": {
"name": "Item_Weapon_S_1451_Name",
"item_type": "W-엔진",
"rank_type": 4
},
"14138": {
"name": "순결한 희생",
"item_type": "W-엔진",
"rank_type": 4
},
"14146": {
"name": "기계 심장에 내린 씨앗",
"item_type": "W-엔진",
"rank_type": 4
},
"14136": {
"name": "탐혼의 눈동자",
"item_type": "W-엔진",
@@ -2953,6 +3313,11 @@
"item_type": "W-엔진",
"rank_type": 4
},
"14141": {
"name": "너구리의 7단 변신",
"item_type": "W-엔진",
"rank_type": 4
},
"13101": {
"name": "데마라 배터리 Ⅱ형",
"item_type": "W-엔진",
@@ -3033,6 +3398,11 @@
"item_type": "W-엔진",
"rank_type": 3
},
"14140": {
"name": "완벽하게 단조된 별",
"item_type": "W-엔진",
"rank_type": 4
},
"13013": {
"name": "도금된 화신풍",
"item_type": "W-엔진",
@@ -3093,6 +3463,11 @@
"item_type": "W-엔진",
"rank_type": 3
},
"13144": {
"name": "Item_Weapon_A_1441_Name",
"item_type": "W-엔진",
"rank_type": 3
},
"13128": {
"name": "뛰뛰빵빵",
"item_type": "W-엔진",
@@ -3153,6 +3528,11 @@
"item_type": "에이전트",
"rank_type": 4
},
"1401": {
"name": "앨리스",
"item_type": "에이전트",
"rank_type": 4
},
"1011": {
"name": "엔비",
"item_type": "에이전트",
@@ -3198,6 +3578,11 @@
"item_type": "에이전트",
"rank_type": 4
},
"1461": {
"name": "「시드」",
"item_type": "에이전트",
"rank_type": 4
},
"1111": {
"name": "앤톤",
"item_type": "에이전트",
@@ -3208,6 +3593,11 @@
"item_type": "에이전트",
"rank_type": 4
},
"1451": {
"name": "Avatar_Female_Size02_Lucia",
"item_type": "에이전트",
"rank_type": 4
},
"1091": {
"name": "미야비",
"item_type": "에이전트",
@@ -3228,6 +3618,16 @@
"item_type": "에이전트",
"rank_type": 4
},
"1051": {
"name": "Avatar_Female_Size03_Yidhari",
"item_type": "에이전트",
"rank_type": 4
},
"1411": {
"name": "유즈하",
"item_type": "에이전트",
"rank_type": 4
},
"1291": {
"name": "휴고",
"item_type": "에이전트",
@@ -3243,6 +3643,16 @@
"item_type": "에이전트",
"rank_type": 4
},
"1301": {
"name": "오피 & 「도깨비불」",
"item_type": "에이전트",
"rank_type": 4
},
"1441": {
"name": "코마노 마나토",
"item_type": "에이전트",
"rank_type": 3
},
"1151": {
"name": "루시",
"item_type": "에이전트",
@@ -3313,11 +3723,21 @@
"item_type": "「Bangboo」",
"rank_type": 3
},
"54018": {
"name": "에스메 양",
"item_type": "「Bangboo」",
"rank_type": 4
},
"54015": {
"name": "찰칵이",
"item_type": "「Bangboo」",
"rank_type": 4
},
"53016": {
"name": "엑스칼리부",
"item_type": "「Bangboo」",
"rank_type": 3
},
"54016": {
"name": "로빈",
"item_type": "「Bangboo」",
@@ -3373,6 +3793,11 @@
"item_type": "「Bangboo」",
"rank_type": 3
},
"54019": {
"name": "「머큐리」",
"item_type": "「Bangboo」",
"rank_type": 4
},
"54017": {
"name": "사야",
"item_type": "「Bangboo」",
@@ -3434,5 +3859,5 @@
"rank_type": 4
}
},
"version": "2.0"
"version": "2.3.0"
}

View File

@@ -6,13 +6,7 @@ import requests
from opencc import OpenCC
# 初始化 OpenCC 转换器
cc = OpenCC('s2t')
# 获取 JSON 数据
weapon_url = 'https://api.hakush.in/zzz/data/weapon.json'
character_url = 'https://api.hakush.in/zzz/data/character.json'
bangboo_url = 'https://api.hakush.in/zzz/data/bangboo.json'
version_url = 'https://api.hakush.in/zzz/new.json'
cc = OpenCC("s2t")
# 语言映射配置
language_map = {
@@ -20,45 +14,73 @@ language_map = {
"zh-tw": "CHS", # 简体转繁体
"en-us": "EN",
"ja-jp": "JA",
"ko-kr": "KO"
"ko-kr": "KO",
}
# 类型映射配置
type_map = {
"weapon": {"zh-cn": "音擎", "zh-tw": "音擎", "en-us": "W-Engines", "ja-jp": "音動機", "ko-kr": "W-엔진"},
"character": {"zh-cn": "代理人", "zh-tw": "代理人", "en-us": "Agents",
"ja-jp": "エージェント", "ko-kr": "에이전트"},
"bangboo": {"zh-cn": "邦布", "zh-tw": "邦布", "en-us": "Bangboo",
"ja-jp": "ボンプ", "ko-kr": "「Bangboo」"}
"weapon": {
"zh-cn": "音擎",
"zh-tw": "音擎",
"en-us": "W-Engines",
"ja-jp": "音動機",
"ko-kr": "W-엔진",
},
"character": {
"zh-cn": "代理人",
"zh-tw": "代理人",
"en-us": "Agents",
"ja-jp": "エージェント",
"ko-kr": "에이전트",
},
"bangboo": {
"zh-cn": "邦布",
"zh-tw": "邦布",
"en-us": "Bangboo",
"ja-jp": "ボンプ",
"ko-kr": "「Bangboo」",
},
}
def fetch_json(url):
response = requests.get(url, timeout=10)
response.raise_for_status()
return response.json()
def transform_data(data, item_type):
transformed = {lang: {} for lang in language_map.keys()}
for id_, item in data.items():
for lang, key in language_map.items():
name = item[key] if lang != 'zh-tw' else cc.convert(item['CHS'])
name = item[key] if lang != "zh-tw" else cc.convert(item["CHS"])
transformed[lang][id_] = {
"name": name,
"item_type": type_map[item_type][lang],
"rank_type": item['rank']
"rank_type": item["rank"],
}
return transformed
def main():
try:
version_url = "https://api.hakush.in/zzz/new.json"
version_data = fetch_json(version_url)
latest_version = (
version_data.get("previous")[0] if version_data.get("previous") else "data"
)
weapon_url = f"https://api.hakush.in/zzz/{latest_version}/weapon.json"
character_url = f"https://api.hakush.in/zzz/{latest_version}/character.json"
bangboo_url = f"https://api.hakush.in/zzz/{latest_version}/bangboo.json"
weapon_data = fetch_json(weapon_url)
character_data = fetch_json(character_url)
bangboo_data = fetch_json(bangboo_url)
version_data = fetch_json(version_url)
transformed_data = {lang: {} for lang in language_map.keys()}
transformed_data["version"] = version_data["version"]
transformed_data["version"] = latest_version
weapon_transformed = transform_data(weapon_data, "weapon")
character_transformed = transform_data(character_data, "character")
@@ -69,7 +91,7 @@ def main():
transformed_data[lang].update(character_transformed[lang])
transformed_data[lang].update(bangboo_transformed[lang])
with open('./src/idJson.json', 'w', encoding='utf-8') as f:
with open("./src/idJson.json", "w", encoding="utf-8") as f:
json.dump(transformed_data, f, ensure_ascii=False, indent=2)
print("Data successfully transformed and saved")
@@ -77,5 +99,6 @@ def main():
except requests.RequestException as e:
print(f"Error fetching data: {e}")
if __name__ == "__main__":
main()