chore: moved the VIDEO LENGTH var

pull/790/head
Jason 2 years ago
parent a5fe2eface
commit 03b533cca9

@ -9,7 +9,7 @@ from rich.progress import track
from moviepy.editor import AudioFileClip, CompositeAudioClip, concatenate_audioclips from moviepy.editor import AudioFileClip, CompositeAudioClip, concatenate_audioclips
from utils.console import print_step, print_substep from utils.console import print_step, print_substep
from utils.voice import sanitize_text from utils.voice import sanitize_text
DEFUALT_MAX_LENGTH: int = 50
class TTSEngine: class TTSEngine:
@ -30,7 +30,7 @@ class TTSEngine:
tts_module, tts_module,
reddit_object: dict, reddit_object: dict,
path: str = "assets/temp/mp3", path: str = "assets/temp/mp3",
max_length: int = 50, max_length: int = DEFUALT_MAX_LENGTH,
): ):
self.tts_module = tts_module() self.tts_module = tts_module()
self.reddit_object = reddit_object self.reddit_object = reddit_object

@ -22,11 +22,8 @@ TTSProviders = {
"TikTok": TikTok, "TikTok": TikTok,
} }
VIDEO_LENGTH: int = 40 # secs
def save_text_to_mp3(reddit_obj: dict[str]) -> tuple[int, int]: def save_text_to_mp3(reddit_obj: dict[str]) -> tuple[int, int]:
"""Saves text to MP3 files. Goes through the reddit_obj and generates the title MP3 file and a certain number of comments until the total amount of time exceeds VIDEO_LENGTH seconds. """Saves text to MP3 files.
Args: Args:
reddit_obj (dict[str]): Reddit object received from reddit API in reddit/subreddit.py reddit_obj (dict[str]): Reddit object received from reddit API in reddit/subreddit.py
@ -41,7 +38,6 @@ def save_text_to_mp3(reddit_obj: dict[str]) -> tuple[int, int]:
get_case_insensitive_key_value(TTSProviders, env), reddit_obj get_case_insensitive_key_value(TTSProviders, env), reddit_obj
) )
else: else:
choice = ""
while True: while True:
print_step("Please choose one of the following TTS providers: ") print_step("Please choose one of the following TTS providers: ")
print_table(TTSProviders) print_table(TTSProviders)

Loading…
Cancel
Save