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