|
|
|
@ -72,7 +72,7 @@ class TTSEngine:
|
|
|
|
|
print_substep("Saved Text to MP3 files successfully.", style="bold green")
|
|
|
|
|
return self.length, idx
|
|
|
|
|
|
|
|
|
|
def split_post(self, text: str, idx: int) -> str:
|
|
|
|
|
def split_post(self, text: str, idx: int):
|
|
|
|
|
split_files = []
|
|
|
|
|
split_text = [
|
|
|
|
|
x.group().strip()
|
|
|
|
@ -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")
|
|
|
|
@ -100,6 +106,7 @@ class TTSEngine:
|
|
|
|
|
# self.length += sox.file_info.duration(f"{self.path}/{filename}.mp3")
|
|
|
|
|
clip = AudioFileClip(f"{self.path}/{filename}.mp3")
|
|
|
|
|
self.length += clip.duration
|
|
|
|
|
clip.close()
|
|
|
|
|
|
|
|
|
|
def process_text(text: str):
|
|
|
|
|
lang = getenv("POSTLANG", "")
|
|
|
|
|