-
Notifications
You must be signed in to change notification settings - Fork 2
/
voice_bot.py
executable file
·53 lines (40 loc) · 1.39 KB
/
voice_bot.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
#!/usr/bin/env python3
import sys
import asyncio
from KcwikiVoiceClient import KcwikiVoiceClient
def printHelp():
print('''kcwiki_bot - kcwiki语音更新助手
用法:
python voice_bot.py [command]
命令:
\tfix(f)\t\t修复更新语音下载
\tdownload(d)\t查看更新语音并下载
\tupload(u)\t上传语音到zh.kcwiki.moe(必须已下载语音文件)
\tgenwiki(g)\t生成wikicode
使用 "python voice_bot.py help" 查看帮助。
''')
async def main():
voiceClient = KcwikiVoiceClient()
if len(sys.argv) == 2:
if sys.argv[1] == 'download' or sys.argv[1] == 'd':
print('start to download.')
await voiceClient.downloadVoice()
elif sys.argv[1] == 'fix' or sys.argv[1] == 'f':
print('start fixing.')
await voiceClient.fixRetryVoice()
elif sys.argv[1] == 'upload' or sys.argv[1] == 'u':
print('start to upload.')
await voiceClient.removeDuplicatedVoice()
await voiceClient.uploadVoice()
elif sys.argv[1] == 'genwiki' or sys.argv[1] == 'g':
print('start to generate wikicode.')
await voiceClient.generateWikiCode()
elif sys.argv[1] == 'help' or sys.argv[1] == 'h':
printHelp()
else:
printHelp()
print()
else:
printHelp()
loop = asyncio.get_event_loop()
loop.run_until_complete(main())