-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate_image_paths.py
More file actions
49 lines (39 loc) · 2.07 KB
/
Copy pathupdate_image_paths.py
File metadata and controls
49 lines (39 loc) · 2.07 KB
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
#!/usr/bin/env python3
"""
更新图片路径为英文文件名
"""
import re
# 更新clothes_data.py
with open('clothes_data.py', 'r', encoding='utf-8') as f:
content = f.read()
# 替换图片路径
replacements = {
'/static/clothes-middle-east/衣服1.png': '/static/clothes-middle-east/item1.png',
'/static/clothes-middle-east/衣服2.png': '/static/clothes-middle-east/item2.png',
'/static/clothes-middle-east/衣服3.png': '/static/clothes-middle-east/item3.png',
'/static/clothes-middle-east/衣服4.png': '/static/clothes-middle-east/item4.png',
'/static/clothes-middle-east/衣服5.png': '/static/clothes-middle-east/item5.png',
'/static/clothes-middle-east/衣服6.png': '/static/clothes-middle-east/item6.png',
'/static/clothes-middle-east/衣服7.png': '/static/clothes-middle-east/item7.png',
'/static/clothes-middle-east/衣服8.png': '/static/clothes-middle-east/item8.png',
'/static/clothes-middle-east/衣服9.png': '/static/clothes-middle-east/item9.png',
'/static/clothes-middle-east/衣服10.png': '/static/clothes-middle-east/item10.png',
'/static/clothes-middle-east/衣服11.png': '/static/clothes-middle-east/item11.png',
'/static/clothes-middle-east/衣服12.png': '/static/clothes-middle-east/item12.png',
'/static/clothes-middle-east/睡衣.png': '/static/clothes-middle-east/sleepwear.png',
'/static/clothes-middle-east/杂志.png': '/static/clothes-middle-east/magazine1.png',
'/static/clothes-middle-east/杂志交换.png': '/static/clothes-middle-east/magazine2.png',
}
for old, new in replacements.items():
content = content.replace(old, new)
with open('clothes_data.py', 'w', encoding='utf-8') as f:
f.write(content)
print('✅ 已更新clothes_data.py中的图片路径')
# 更新translations.py中的中文数据
with open('translations.py', 'r', encoding='utf-8') as f:
content = f.read()
for old, new in replacements.items():
content = content.replace(old, new)
with open('translations.py', 'w', encoding='utf-8') as f:
f.write(content)
print('✅ 已更新translations.py中的图片路径')