fix: Avoid the same filename under multithreading (#933)

This commit is contained in:
JS00000
2023-04-23 23:56:32 +08:00
committed by GitHub
parent d6a4b35cd3
commit dca5c058e0
4 changed files with 7 additions and 4 deletions

View File

@@ -34,7 +34,7 @@ class PyttsVoice(Voice):
def textToVoice(self, text):
try:
# avoid the same filename
# Avoid the same filename under multithreading
wavFileName = "reply-" + str(int(time.time())) + "-" + str(hash(text) & 0x7FFFFFFF) + ".wav"
wavFile = TmpDir().path() + wavFileName
logger.info("[Pytts] textToVoice text={} voice file name={}".format(text, wavFile))