From c4da2fa55a4d30e28838a7aa58e0f08f0dc8ea38 Mon Sep 17 00:00:00 2001 From: Callum Leslie Date: Mon, 4 Jul 2022 20:33:59 +0100 Subject: [PATCH] fix: close ALL clips when finished --- TTS/engine_wrapper.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/TTS/engine_wrapper.py b/TTS/engine_wrapper.py index 017cf79..13ff850 100644 --- a/TTS/engine_wrapper.py +++ b/TTS/engine_wrapper.py @@ -88,9 +88,15 @@ class TTSEngine: f"{self.path}/{idx}.mp3", fps=44100, verbose=False, logger=None ) - for i in range(0, idy + 1): + for i in split_files: + name = i.filename + i.close() + Path(name).unlink() + + # for i in range(0, idy + 1): # print(f"Cleaning up {self.path}/{idx}-{i}.part.mp3") - Path(f"{self.path}/{idx}-{i}.part.mp3").unlink() + + # Path(f"{self.path}/{idx}-{i}.part.mp3").unlink() def call_tts(self, filename: str, text: str): self.tts_module.run(text=process_text(text), filepath=f"{self.path}/{filename}.mp3")