Skip to content

Commit

Permalink
Update speech_synthesizer.py
Browse files Browse the repository at this point in the history
放弃了删除失败时的合成文件
  • Loading branch information
DanDDXuanX committed Aug 5, 2022
1 parent b335779 commit d4db46b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions speech_synthesizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,11 @@ def start(self,text,ofile):
# 若没有发言内容,阿里云也会生成一个44字节的空文件!
if os.path.getsize(ofile) <= 128:
# 删除文件
os.remove(ofile)
# os.remove(ofile)
raise Exception('[AliyunError]: Synthesis failed, an empty wav file is created!')
# 检查合成返回值是否成功
elif success == False:
os.remove(ofile)
# os.remove(ofile)
raise Exception('[AliyunError]: Other exception occurred!')
else:
if len(text) >= 5:
Expand Down Expand Up @@ -217,7 +217,7 @@ def start(self,text,ofile):
if cancellation_details.error_details:
print("[AzureError]: {}".format(cancellation_details.error_details))
# 删除文件
os.remove(ofile)
# os.remove(ofile)
raise Exception("[AzureError]: {}".format(cancellation_details.reason))

# 从主程序借来的Audio类
Expand Down

0 comments on commit d4db46b

Please sign in to comment.