From c603884721f2e620b6816db5743d2f721c72be60 Mon Sep 17 00:00:00 2001 From: Callum Leslie Date: Mon, 6 Jun 2022 17:44:08 +0100 Subject: [PATCH] Add init function with constructors --- tts/engine_wrapper.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/tts/engine_wrapper.py b/tts/engine_wrapper.py index 8296935..b0f09e2 100644 --- a/tts/engine_wrapper.py +++ b/tts/engine_wrapper.py @@ -4,4 +4,20 @@ from utils.console import print_step, print_substep from rich.progress import track class TTSEngine: - pass \ No newline at end of file + + """Calls the given TTS engine to reduce code duplication and allow multiple TTS engines. + Args: + tts_function : The function that will be called. Your function should handle the TTS itself and saving to the given path. + reddit_object : The reddit object that contains the posts to read. + path (Optional) : The unix style path to save the mp3 files to. This must not have leading or trailing slashes. + max_length (Optional) : The maximum length of the mp3 files in total. + Notes: + tts_function must take the parameters text and filepath as arguments. + """ + + def __init__(self, tts_function: function, reddit_object, path: str = "assets/mp3", max_length: int = 50): + self.tts_function = tts_function + self.reddit_object = reddit_object + self.path = path + self.max_length = max_length + self.length = 0