From 3dcf20f314fa67404f7f0b06363aa5e64aed9aab Mon Sep 17 00:00:00 2001 From: Drugsosos <44712637+Drugsosos@users.noreply.github.com> Date: Sat, 11 Jun 2022 20:33:38 +0300 Subject: [PATCH] added dependancy on env var --- .env.template | 6 +++++- video_creation/voices.py | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.env.template b/.env.template index 5830840..fb6b252 100644 --- a/.env.template +++ b/.env.template @@ -26,4 +26,8 @@ OPACITY="0.9" # The absolute path of the folder where you want to save the final video # If empty or wrong, the path will be 'assets/' -FINAL_VIDEO_PATH="" \ No newline at end of file +FINAL_VIDEO_PATH="" + +# If True, all text that go through TTS will be filtered by inappropriate language +# Use "True" or "False" (default) +PROFANE_FILTER="False" \ No newline at end of file diff --git a/video_creation/voices.py b/video_creation/voices.py index 027bb75..dc2d330 100644 --- a/video_creation/voices.py +++ b/video_creation/voices.py @@ -7,6 +7,7 @@ from rich.progress import track from rich.console import Console import re +import os from video_creation.profane_list.en import profane_list console = Console() @@ -15,7 +16,7 @@ console = Console() def profane_filter(text: str, word_list: list) -> str: word_list.sort(reverse=True, key=len) filtered_text = text - if any([word in word_list for word in text.split()]): + if any([word in word_list for word in text.split()]) and bool(os.getenv("PROFANE_FILTER", False)): for word in word_list: if word in text: word_lenght = word.__len__()