def TTSBaidu(self, tid, txt, lan, spd):
'''
get the BAIDU.COM's TTS url
filename: save the txt's Speech in the file with filetype .wav
lan: language, 'en' for English or 'zh' for Chinese
txt: the TTS text
spd: the speedding of read
'''
socket.setdefaulttimeout(34.0)
try:
#print('processing... ',tid, txt)
ttsUrl = genTTSUrl(lan ,txt, spd)
c = getpage(ttsUrl)
#?master?????
#print('processing...finished',tid)
self.results[tid]=c
except urllib.error.URLError as e:
print("error:URLError ",e," we will try again...tid:",tid)
self.TTSBaidu(tid, txt, lan, spd)
except socket.timeout:
print("error: TTSBaidu time out!, we will try again...tid:",tid )
self.TTSBaidu(tid, txt, lan, spd)
finally:
pass
评论列表
文章目录