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)]