From 45956c409ae397199498896a38b93bd15c52c4bc Mon Sep 17 00:00:00 2001 From: Jason Date: Tue, 7 Jun 2022 09:45:26 -0400 Subject: [PATCH] tried to implement smth --- video_creation/TTSwrapper.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/video_creation/TTSwrapper.py b/video_creation/TTSwrapper.py index b2e4447..f5ae5e5 100644 --- a/video_creation/TTSwrapper.py +++ b/video_creation/TTSwrapper.py @@ -5,7 +5,9 @@ import os import random import requests from moviepy.editor import AudioFileClip, concatenate_audioclips, CompositeAudioClip - +#from profanity_filter import ProfanityFilter +#pf = ProfanityFilter() +# Code by @JasonLovesDoggo # https://twitter.com/scanlime/status/1512598559769702406 nonhuman = [ # DISNEY VOICES 'en_us_ghostface', # Ghost Face @@ -63,9 +65,11 @@ class TTTTSWrapper: # TikTok Text-to-Speech Wrapper def __init__(self): self.URI_BASE = 'https://api16-normal-useast5.us.tiktokv.com/media/api/text/speech/invoke/?text_speaker=' - def tts(self, req_text: str = "TikTok Text To Speech", filename: str = 'title.mp3', random_speaker: bool = False): + def tts(self, req_text: str = "TikTok Text To Speech", filename: str = 'title.mp3', random_speaker: bool = False, censer=False): req_text = req_text.replace("+", "plus").replace(" ", "+").replace("&", "and") - + if censer: + #req_text = pf.censor(req_text) + pass voice = self.randomvoice() if random_speaker else (os.getenv('VOICE') or random.choice(human)) chunks = [m.group().strip() for m in re.finditer(r' *((.{0,200})(\.|.$))', req_text)]