-
-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[求助]之前的记录导入了派蒙中,现在想问下如何转为统一可交互格式,方便各类软件交互 #520
Labels
question
Further information is requested
Comments
你是指抽卡记录?派蒙目前只能导出uigf2.2标准的抽卡记录文件,如果你需要更高标准且有动手能力的欢迎自行根据uigf标准更改代码或提交pr |
就是我有之前的派蒙那个抽卡log文件,想问有没有独立工具转为统一交互格式json |
“导出uigf2.2标准的抽卡记录文件”这部分代码在哪里,或者我可以自己看下独立出来用py自己转 |
|
import json
import datetime,time
def gacha_log_to_UIGF(file_path):
"""
将抽卡记录转换为UIGF格式
:param user_id: 用户id
:param uid: 原神uid
"""
with open(file_path, 'r', encoding='utf-8') as f:
old_gacha_info = json.load(f)
if "集录祈愿" not in old_gacha_info["item_list"]:
old_gacha_info["item_list"]["集录祈愿"] = []
uid = old_gacha_info["uid"]
export_time = datetime.datetime.now().strftime('%Y%m%d %H%M%S')
save_path = f'PAIMON-TO-UIGF [{uid}]-[{export_time}].json'
uigf_dict = {
'info': {
'uid': uid,
'lang': 'zh-cn',
'export_time': datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'),
'export_timestamp': int(time.time()),
'export_app': 'LittlePaimon',
'export_app_version': '1.0',
'uigf_version': 'v2.2'
},
'list': []
}
for items in old_gacha_info['item_list']:
for item in old_gacha_info['item_list'][items]:
uigf_dict['list'].append({
'gacha_type': item.get('gacha_type', ''),
'item_id': '',
'count': '1',
'time': item.get('time', '').strftime('%Y-%m-%d %H:%M:%S') if isinstance(item.get('time'), datetime.datetime) else item.get('time'),
'name': item.get('name', ''),
'item_type': item.get('item_type', ''),
'rank_type': item.get('rank_type', ''),
'id': item.get('id', ''),
'uigf_gacha_type': item.get('gacha_type', ''),
'uid': uid
})
with open(save_path, 'w', encoding='utf-8') as json_file:
json.dump(uigf_dict, json_file, ensure_ascii=False, indent=4)
gacha_log_to_UIGF('gacha_log-xxx-xxx.json') 大概随便搓了一个,但是不知道为啥,这个能导入starward但是导不了wish export,不过可以先导入starward再导出UIGF再导入到wish export |
导入不了就是没有兼容低版本uigf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
如题
The text was updated successfully, but these errors were encountered: