pull/963/head
Drugsosos 2 years ago
parent b4f6fe41ca
commit 01b932bf88
No known key found for this signature in database
GPG Key ID: 8E35176FE617E28D

@ -66,7 +66,7 @@ class TTSEngine:
print_substep('Saved Text to MP3 files successfully.', style='bold green')
return [
comments for comments, condition in
zip(self.reddit_object['comments'], sync_tasks_primary)
zip(range(self.reddit_object['comments'].__len__()), sync_tasks_primary)
if condition
]
@ -75,15 +75,19 @@ class TTSEngine:
filename: str,
text: str
) -> bool:
self.tts_module.run(
if not text:
return False
self.tts_module().run(
text=self.process_text(text),
filepath=f'{self.path}/{filename}.mp3'
)
clip_length = audio_length(f'assets/audio/{filename}.mp3')
clip_length = audio_length(f'assets/temp/mp3/{filename}.mp3')
print(clip_length, '/', self.__total_length)
if self.__total_length + clip_length <= self.max_length:
self.max_length += clip_length
self.__total_length += clip_length
return True
return False

@ -28,6 +28,7 @@ from video_creation.background import download_background, chop_background_video
console = Console()
W, H = 1080, 1920 # TODO move to config
max_length: int = 50 # TODO move to config
def name_normalize(

@ -16,7 +16,7 @@ TTSProviders = {
}
async def save_text_to_mp3(
def save_text_to_mp3(
reddit_obj: dict,
) -> list:
"""Saves text to MP3 files.
@ -37,17 +37,8 @@ async def save_text_to_mp3(
if voice.casefold() in map(lambda _: _.casefold(), TTSProviders):
break
print('Unknown Choice')
TTS_instance = get_case_insensitive_key_value(TTSProviders, voice)
if TTS_instance == StreamlabsPolly or TTS_instance == TikTok:
from aiohttp import ClientSession
async with ClientSession() as client:
engine_instance = TTSEngine(TTS_instance(client), reddit_obj)
results = await engine_instance.run()
else:
engine_instance = TTSEngine(TTS_instance, reddit_obj)
results = await engine_instance.run()
return results
engine_instance = TTSEngine(get_case_insensitive_key_value(TTSProviders, voice), reddit_obj)
return engine_instance.run()
def get_case_insensitive_key_value(

Loading…
Cancel
Save