小米手环 4 手动同步 bin 表盘

小米手环 4 手动同步 bin 表盘

方法一(不推荐)

1. 小米运动下载一个表盘

从小米运动里随便找个表盘,记住找的哪一个,然后同步

2. 替换文件

1
此电脑\Redmi K30 Pro\内部存储设备\Android\data\com.xiaomi.hm.health\files\watch_skin_local

内找到刚下载的表盘,表盘是一个文件夹,名字类似7ec60bf34ee7258203b9379495505706

打开里面有缩略图

3. 再次同步

将文件夹内的bin替换成下载的第三方bin,回到小米运动app,打开刚才下的表盘,点击立即同步

方法二(推荐)

手动构造表盘文件夹,先随便新建个文件夹

1. XML

在文件夹内创建infos.xml XML 文件

名称为 infos.xml注意是 infos 不是 info

1
2
3
4
5
<?xml version='1.0' encoding='utf-8' standalone='yes' ?>
<watch_skin_info>
<info>{"O00000oO":"表盘名称","O00000oo":0,"O0000O0o":103587,"O0000OOo":0,"O0000Oo":false}
</info>
</watch_skin_info>

2. 图片

相同目录下放入一个 120X240png格式图片用于预览图

3. bin

相同目录下放入下载的bin文件

4. 打包

以上所有三个文件放入同一文件夹,把这个文件夹放到:

1
此电脑\Redmi K30 Pro\内部存储设备\Android\data\com.xiaomi.hm.health\files\watch_skin_local

附:方法二自动打包,调用 aio 函数即可

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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
"""
从网上下载符合要求的图片和 bin 文件,打开此程序
输入文件名后自动处理打包
"""
import os
import shutil
import PySimpleGUI as sg

HELP = """
从网上下载符合要求的图片和 bin 文件,
并放在此程序所在的文件夹,
打开此程序,输入一个自定义的名字
此软件自动处理打包
"""


XML = """<?xml version='1.0' encoding='utf-8' standalone='yes' ?><watch_skin_info><info>{"O00000oO":"{{NAME}}","O00000oo":0,"O0000O0o":103587,"O0000OOo":0,"O0000Oo":false}</info></watch_skin_info>"""


def write_xml(folder, name):
""" generate the XML template and write it to XML file """
with open(f'{folder}/infos.xml', 'w', encoding='utf-8') as f:
f.write(XML.replace('{{NAME}}', name))


def name_is_pic(name):
"""check whether the file is picture

checks: 'webp', 'jpg', 'jpeg', 'gif'
"""
ext = name.split('.')[-1]
if ext in {'webp', 'jpg', 'jpeg', 'gif'}:
return True
return False


def convert_png(folder):
""" 把图片后缀改成png """
for file in os.listdir(folder):
# base name
name_without_ext = file.split('.')[0]
# is picture
if name_is_pic(file):
print('[I] 转换图片: %s' % file)
os.system(f'magick "{folder}\\{file}" "{folder}\\{name_without_ext}.png"')
# list dirs again to check the num of png
pngs = [i for i in os.listdir(folder) if i.endswith('.png')]
if len(pngs) > 1:
for j in pngs[1:]:
os.remove(f'{folder}\\{j}')
print('[I] 删除: %s' % j)
os.remove(f'{folder}\\{file}')
print('[I] 删除: %s' % file)
else:
print('[X] 文件夹 %s 内没有图片文件。' % folder)



def aio(skin_name) -> str:
"""
give me the skin name and i will do all things,
return a str describe the status
"""
skin = 'no'
pic = 'no'

if not os.path.exists(skin_name):
os.mkdir(skin_name)

for this_folder_file in os.listdir('./'):
# find Bin file!
if this_folder_file.endswith('.bin'):
skin = 'yes'
print('[I] 识别表盘:%s' % this_folder_file)
bin_file = this_folder_file
# move it
shutil.move(bin_file, f'{skin_name}/{bin_file}')
# generate template
write_xml(skin_name, skin_name)
# whether to download picture
elif name_is_pic(this_folder_file):
pic = 'yes'
print('[I] 识别图片:%s' % this_folder_file)
# move the picture to the directory
shutil.move(this_folder_file, f'{skin_name}\\{this_folder_file}')
convert_png(skin_name)
return f'完成,检测到皮肤:{skin},检测到图片:{pic}'


def gui():
f = ('微软雅黑', 16)
sg.theme('Dark')
layout = [
[sg.Text('表盘名称', font=f),
sg.InputText(key='-NAME-', font=f, size=(20, 1))],

[sg.Text('Ready', key='-STATUS-', size=(30, 1),font=f)],

[sg.Button('生成!', font=f),
sg.Button('退出', font=f),
sg.Button('帮助', font=f)]
]

window = sg.Window('小米手环4表盘生成器', layout)

while True:
event, values = window.read()
print(event, values)
if event == sg.WIN_CLOSED or event == '退出':
break
elif event == '生成!':
text = values['-NAME-']
if not text:
window['-STATUS-'].update('Skin name is required!')
continue
output = aio(text)
window['-STATUS-'].update(output)
elif event == '帮助':
sg.popup('帮助', HELP, font=f)


if __name__ == '__main__':
# aio('tttttttttttttt')
# convert_png('ProstoFace Orange')
gui()


小米手环 4 手动同步 bin 表盘
https://taylorandtony.github.io/2025/01/25/diy-mi-band-4/
作者
TaylorAndTony
发布于
2025年1月25日
许可协议