代码拉取完成,页面将自动刷新
import glob
import json
import os
files = glob.glob("*.mp3")
with open('./temp.json', "r") as f:
temp = json.load(f, encoding="utf-8")
mapper = {tuple(i["keywords"]): i['voices'][0][0:i['voices'][0].find('0')]
for i in temp["contributes"]}
keys = [i["keywords"] for i in temp["contributes"]]
num = len(keys)
for i, ix in enumerate(temp["contributes"]):
ix["voices"] = files[i * len(files) // len(keys)
:(i+1) * len(files) // len(keys)]
for i, ix in enumerate(temp["contributes"]):
for j, jx in enumerate(ix["voices"]):
oldname = jx
os.rename(oldname, oldname+'_')
for i, ix in enumerate(temp["contributes"]):
for j, jx in enumerate(ix["voices"]):
oldname = jx
newname = mapper[tuple(ix["keywords"])] + f'{j + 1:02d}.mp3'
os.rename(oldname+'_', newname)
ix["voices"][j] = newname
os.remove('./contributes.json')
with open('./contributes.json', "w+") as f:
json.dump(temp, f)
info = {
"name": "RedAlert-Voice-Pack", #文件夹名称
"display-name": "RedAlert Voice Pack", #语音包名称
"avatar": "avatar.jpg", #封面
"avatar-dark": "avatar-dark.jpg", #暗光风格封面
"version": "0.0.1", #版本号
"description": "Let's Rock! Commander!", #简介
"languages": ["javascript"], #在哪些编程环境下启用本语音包
"author": "Trotsky1997 Coded.Music by©EA-WestWood", #作者
"gender": "female", #发音性别
"locale": "en" #发音语言
}
os.remove('./manifest.json')
with open('./manifest.json', "w+") as f:
json.dump(info, f)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。