Update uuid to avoid possible race condition

file naming on short sentences could possibly have a race condition. set uuid as opposed to timestamp to avoid this outcome.
This commit is contained in:
erew123 authored and GitHub committed 2023-12-25 21:09:39 +00:00
1 parent c92aa435e5
commit dc9d343115
1 file changed
+2 -3
+2 -3
View File
@@ -618,11 +618,10 @@ def output_modifier(string, state):
def get_output_filename(state):
# Check if character name exists and if not, just call it TTSOUT_
if "character_menu" in state:
return Path(f'{params["output_folder_wav"]}/{state["character_menu"]}_{int(time.time())}.wav').as_posix()
return Path(f'{params["output_folder_wav"]}/{state["character_menu"]}_{str(uuid.uuid4())[:8]}.wav').as_posix()
else:
return Path(f'{params["output_folder_wav"]}/TTSOUT_{int(time.time())}.wav').as_posix()
return Path(f'{params["output_folder_wav"]}/TTSOUT_{str(uuid.uuid4())[:8]}.wav').as_posix()
###############################################