* 识别体力与树脂数量 * 璃月6-奥藏山 * update repo.json * 地图追踪 星银矿石 (#1025) * Add files via upload * 自动修复 JSON 格式和版本号 [ci skip] * Delete repo/pathing/矿物/星银矿石/desktop.ini * Add files via upload --------- Co-authored-by: GitHub Actions Bot <actions@github.com> * Update main.js (#1024) 手动终止夹断 * update repo.json * 6.7 富Abpro (#1022) * Add files via upload * Add files via upload * Delete repo/js/AutoArtifactsPro/assets/ArtifactsPath/A路线/01普通/000【激活程序】稻妻大炮.json * Delete repo/js/AutoArtifactsPro/assets/ArtifactsPath/A路线/01普通/404须弥-天臂池七天神像4.json * Delete repo/js/AutoArtifactsPro/assets/ArtifactsPath/A路线/01普通/601纳塔-流泉之众4.json * Delete repo/js/AutoArtifactsPro/assets/ArtifactsPath/A路线/01普通/602纳塔-悬木人声望2.json * Delete repo/js/AutoArtifactsPro/assets/ArtifactsPath/A路线/01普通/603纳塔-花羽会西2.json * Add files via upload * update repo.json * `七圣召唤七日历练`: 修复牌币已满时卡在出战界面的问题 (#1017) * update repo.json * js:狗粮重置版1.2更新 (#1026) * update repo.json * fix: 修复部分情况下未找到图标直接结束 * temp * add: 璃月7 * feat: 新的数据结构 * add: 合并代码,功能待实现 --------- Co-authored-by: 寒烟 <2841974482@qq.com> Co-authored-by: physligl <181079228+physligl@users.noreply.github.com> Co-authored-by: Tooltingsu <143606015+Tooltingsu@users.noreply.github.com> Co-authored-by: GitHub Actions Bot <actions@github.com> Co-authored-by: JJMdzh <jjjjedyx@qq.com> Co-authored-by: 汐 <121607261+jiegedabaobei@users.noreply.github.com> Co-authored-by: Patrick-Ze <19711799+Patrick-Ze@users.noreply.github.com> Co-authored-by: mno <718135749@qq.com> Co-authored-by: 秋云 <physligl@gmail.com>
59 lines
2.7 KiB
Python
59 lines
2.7 KiB
Python
def test_filename_parsing():
|
|
"""测试文件名解析功能,确保能正确处理各种格式"""
|
|
test_files = [
|
|
"蒙德1-风啸山岭-1.json", # 标准格式
|
|
"璃月3-轻策庄-2.json", # 标准格式
|
|
"蒙德2-清泉镇-4-1.json", # 特殊格式(双连字符数字)
|
|
"须弥2-须弥城-3-2.json", # 特殊格式
|
|
"纳塔1-区域-5.5.json" # 小数点路线编号
|
|
]
|
|
|
|
print("测试文件名解析结果:")
|
|
for filename in test_files:
|
|
result = parse_region_area_number(filename)
|
|
if len(result) == 5: # 特殊格式
|
|
region_name, region_num, area, route_num, route_sub_num = result
|
|
print(f"文件: {filename} (特殊格式)")
|
|
print(f" 区域名称: {region_name}")
|
|
print(f" 区域编号: {region_num}")
|
|
print(f" 地区: {area}")
|
|
print(f" 路线编号: {route_num}")
|
|
print(f" 路线子编号: {route_sub_num}")
|
|
else: # 标准格式
|
|
region_name, region_num, area, route_num = result
|
|
print(f"文件: {filename} (标准格式)")
|
|
print(f" 区域名称: {region_name}")
|
|
print(f" 区域编号: {region_num}")
|
|
print(f" 地区: {area}")
|
|
print(f" 路线编号: {route_num}")
|
|
|
|
# 测试格式化逻辑
|
|
if region_name and region_num and route_num:
|
|
if len(result) == 5: # 特殊格式
|
|
route_sub_num = result[4]
|
|
if area and "-" in area:
|
|
# 特殊格式
|
|
area_parts = area.split("-")
|
|
if len(area_parts) == 2:
|
|
formatted = f"{region_name}{region_num}-{area_parts[1]}-{int(route_num)}-{int(route_sub_num)}"
|
|
else:
|
|
formatted = f"{region_name}{region_num}-{area}-{int(route_num)}-{int(route_sub_num)}"
|
|
else:
|
|
# 非预期情况,但仍处理
|
|
formatted = f"{region_name}{region_num}-{area}-{int(route_num)}-{int(route_sub_num)}"
|
|
else: # 标准格式
|
|
if area and "-" in area:
|
|
# 特殊格式
|
|
area_parts = area.split("-")
|
|
if len(area_parts) == 2:
|
|
formatted = f"{region_name}{region_num}-{area_parts[1]}-{int(route_num)}"
|
|
else:
|
|
formatted = f"{region_name}{region_num}-{int(route_num)}"
|
|
else:
|
|
# 标准格式
|
|
formatted = f"{region_name}{region_num}-{int(route_num)}"
|
|
print(f" 格式化区域: {formatted}")
|
|
else:
|
|
print(f" 解析失败")
|
|
print("")
|