紧急修复
修复麦克风热启动的bug.
This commit is contained in:
parent
03ec9ef054
commit
4bcb28e182
@ -201,6 +201,7 @@ class Recorder:
|
||||
audio_data_list = []
|
||||
while self.__running:
|
||||
try:
|
||||
cfg.load_config()
|
||||
record = cfg.config['source']['record']
|
||||
if not record['enabled'] and not self.is_remote:
|
||||
time.sleep(0.1)
|
||||
|
@ -93,7 +93,7 @@ class Speech:
|
||||
httpHeaders = {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
text = f"<speak><break time='0.2s'/>{text}</speak>"
|
||||
text = f"<speak>{text}</speak>"
|
||||
# 设置HTTPS Body。
|
||||
body = {'appkey': self.ali_nls_app_key, 'token': self.token,'speech_rate':0, 'text': text, 'format': 'wav', 'sample_rate': 16000, 'voice': config_util.config["attribute"]["voice"]}
|
||||
body = json.dumps(body)
|
||||
@ -118,7 +118,6 @@ class Speech:
|
||||
file_url = None
|
||||
return file_url
|
||||
conn.close()
|
||||
print(time.time() - tt)
|
||||
return file_url
|
||||
else:
|
||||
util.log(1, "[x] 语音转换失败!")
|
||||
|
@ -124,5 +124,6 @@ def save_config(config_data):
|
||||
file = codecs.open('config.json', mode='w', encoding='utf-8')
|
||||
file.write(json.dumps(config, sort_keys=True, indent=4, separators=(',', ': ')))
|
||||
file.close()
|
||||
load_config()
|
||||
# for line in json.dumps(config, sort_keys=True, indent=4, separators=(',', ': ')).split("\n"):
|
||||
# print(line)
|
||||
|
Loading…
Reference in New Issue
Block a user