-
Notifications
You must be signed in to change notification settings - Fork 237
/
map_res_list.py
58 lines (46 loc) · 1.74 KB
/
map_res_list.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
'''
Author: Night-stars-1 [email protected]
Date: 2023-05-13 03:08:07
LastEditors: Night-stars-1 [email protected]
LastEditTime: 2023-05-25 15:11:02
FilePath: \Honkai-Star-Rail-beta-2.4h:\Download\Zip\Honkai-Star-Rail-beta-2.7\map_res_list.py
Description:
Copyright (c) 2023 by ${git_name_email}, All Rights Reserved.
'''
import datetime
import hashlib
import json
import os
from pathlib import Path
star_path = Path(__file__).parent
star_list = []
this_path = str(Path(__file__).parent)
for file in star_path.rglob('*'):
if '.git' not in str(file) and '__' not in str(file) and 'version.json' not in str(file) and '.gitignore' not in str(file) and 'LICENSE' not in str(file) and 'star_list.json' not in str(file) and os.path.isfile(file):
star_list.append({
'path': str(file).replace(this_path, '').replace('\\', '/').lstrip('/'),
'hash': hashlib.md5(file.read_bytes()).hexdigest()
})
with open('star_list.json', 'w', encoding='utf-8') as f:
json.dump(star_list, f, ensure_ascii=False, indent=2)
# 获取当前时间(UTC+8)
current_time = datetime.datetime.utcnow() + datetime.timedelta(hours=8)
# 生成版本号
version = current_time.strftime("%Y%m%d%H%M%S")
# 创建版本号字典
version_dict = {
"version": version
}
# 写入到version.json文件
with open("version.json", "w") as file:
json.dump(version_dict, file)
'''
with open('config.json','r') as f:
config = json.load(f)
config['start'] = False
config['map_version'] = "0"
config['picture_version'] = "0"
config['star_version'] = "0"
with open('config.json', 'w', encoding='utf-8') as f:
json.dump(config, f, ensure_ascii=False, indent=2)
'''