-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconv.py
81 lines (67 loc) · 1.95 KB
/
conv.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import requests
def uigf24p(old_file, output):
output["hk4e"] = [
{
"uid": old_file["info"]["uid"],
"timezone": old_file["info"]["region_time_zone"],
"lang": old_file["info"]["lang"],
"list": old_file["list"],
}
]
return output
def srgf(old_file, output):
output["hkrpg"] = [
{
"uid": old_file["info"]["uid"],
"timezone": old_file["info"]["region_time_zone"],
"lang": old_file["info"]["lang"],
"list": old_file["list"],
}
]
return output
def uigf23(old_file, output):
prefix = int(old_file["info"]["uid"][-9])
if 1 <= prefix and prefix <= 5 or prefix == 8 or prefix == 9:
timezone = 8
elif prefix == 6:
timezone = -5
elif prefix == 7:
timezone = 1
output["hk4e"] = [
{
"uid": old_file["info"]["uid"],
"timezone": timezone,
"lang": old_file["info"]["lang"],
"list": old_file["list"],
}
]
return output
def uigf22(old_file, output):
lang_map = {
'zh-cn':'chs',
'zh-tw':'cht',
'de-de':'de',
'en-us':'en',
'ja-jp':'jp',
'ru-ru':'ru'
}
prefix = int(old_file["info"]["uid"][-9])
if 1 <= prefix and prefix <= 5 or prefix == 8 or prefix == 9:
timezone = 8
elif prefix == 6:
timezone = -5
elif prefix == 7:
timezone = 1
output["hk4e"] = [
{
"uid": old_file["info"]["uid"],
"timezone": timezone,
"lang": old_file["info"]["lang"],
"list": [],
}
]
data_itemid = requests.get('https://api.uigf.org/dict/genshin/{}.json'.format(lang_map.get(old_file['info']['lang'], 'chs'))).json()
for i in old_file["list"]:
i['item_id'] = str(data_itemid.get(i['name']))
output['hk4e'][0]['list'].append(i)
return output