Compare commits

..

No commits in common. "5dec6a827321fbcef574e3ddfed90abac94befa1" and "a660c03bb528c7f338d06dc87915cb57a5339b7a" have entirely different histories.

3 changed files with 9 additions and 14 deletions

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

@ -114,7 +114,7 @@ const changeCurrent = async (uid) => {
const detectGameLocale = async (userPath) => { const detectGameLocale = async (userPath) => {
let list = [] let list = []
const lang = app.getLocale() const lang = app.getLocale()
const arr = ['/miHoYo/绝区零/', '/miHoYo/ZenlessZoneZero/'] const arr = ['/miHoYo/绝区零/', '/Cognosphere/Zenless Zone Zero/']
arr.forEach(str => { arr.forEach(str => {
try { try {
const pathname = path.join(userPath, '/AppData/LocalLow/', str, 'Player.log') const pathname = path.join(userPath, '/AppData/LocalLow/', str, 'Player.log')

@ -1,8 +1,5 @@
# pylint: disable=C0116, C0103, C0201
"""Download and process data from the Hakushin API"""
import json
import requests import requests
import json
from opencc import OpenCC from opencc import OpenCC
# 初始化 OpenCC 转换器 # 初始化 OpenCC 转换器
@ -25,23 +22,21 @@ language_map = {
# 类型映射配置 # 类型映射配置
type_map = { type_map = {
"weapon": {"zh-cn": "音擎", "zh-tw": "音擎", "en-us": "W-Engines", "ja-jp": "音動機", "ko-kr": "W-엔진"}, "weapon": {"zh-cn": "音擎", "zh-tw": "音擎", "en-us": "W-Engines", "ja-jp": "音動機", "ko-kr": "W-엔진"},
"character": {"zh-cn": "代理人", "zh-tw": "代理人", "en-us": "Agents", "character": {"zh-cn": "代理人", "zh-tw": "代理人", "en-us": "Agents", "ja-jp": "エージェント", "ko-kr": "에이전트"},
"ja-jp": "エージェント", "ko-kr": "에이전트"}, "bangboo": {"zh-cn": "邦布", "zh-tw": "邦布", "en-us": "Bangboo", "ja-jp": "ボンプ", "ko-kr": "「Bangboo」"}
"bangboo": {"zh-cn": "邦布", "zh-tw": "邦布", "en-us": "Bangboo",
"ja-jp": "ボンプ", "ko-kr": "「Bangboo」"}
} }
def fetch_json(url): def fetch_json(url):
response = requests.get(url, timeout=10) response = requests.get(url)
response.raise_for_status() response.raise_for_status()
return response.json() return response.json()
def transform_data(data, item_type): def transform_data(data, item_type):
transformed = {lang: {} for lang in language_map.keys()} transformed = {lang: {} for lang in language_map.keys()}
for id_, item in data.items(): for id, item in data.items():
for lang, key in language_map.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_] = { transformed[lang][id] = {
"name": name, "name": name,
"item_type": type_map[item_type][lang], "item_type": type_map[item_type][lang],
"rank_type": item['rank'] "rank_type": item['rank']