From 7e3084e88649f53036c29105864964b2630e0feb Mon Sep 17 00:00:00 2001 From: Jason Date: Tue, 7 Jun 2022 18:38:40 -0400 Subject: [PATCH] reformatted --- video_creation/TTSwrapper.py | 18 ++++++++++-------- video_creation/final_video.py | 8 ++++++-- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/video_creation/TTSwrapper.py b/video_creation/TTSwrapper.py index 42158ba..d8fa2ec 100644 --- a/video_creation/TTSwrapper.py +++ b/video_creation/TTSwrapper.py @@ -67,11 +67,11 @@ class TTTTSWrapper: # TikTok Text-to-Speech Wrapper 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, - censer=False, + 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: @@ -100,9 +100,11 @@ class TTTTSWrapper: # TikTok Text-to-Speech Wrapper session = requests.Session() retry = Retry(connect=3, backoff_factor=0.5) adapter = HTTPAdapter(max_retries=retry) - session.mount('http://', adapter) - session.mount('https://', adapter) - r = session.post(f"{self.URI_BASE}{voice}&req_text={chunk}&speaker_map_type=0") + session.mount("http://", adapter) + session.mount("https://", adapter) + r = session.post( + f"{self.URI_BASE}{voice}&req_text={chunk}&speaker_map_type=0" + ) vstr = [r.json()["data"]["v_str"]][0] b64d = base64.b64decode(vstr) diff --git a/video_creation/final_video.py b/video_creation/final_video.py index 42168f7..0df7a1f 100755 --- a/video_creation/final_video.py +++ b/video_creation/final_video.py @@ -43,7 +43,9 @@ def make_final_video(number_of_clips, length): # Gather all images image_clips = [] for i in range(0, number_of_clips): - if opacity is None or float(opacity) >= 1: # opacity not set or is set to one OR MORE + if ( + opacity is None or float(opacity) >= 1 + ): # opacity not set or is set to one OR MORE image_clips.append( ImageClip(f"assets/temp/png/comment_{i}.png") .set_duration(audio_clips[i + 1].duration) @@ -58,7 +60,9 @@ def make_final_video(number_of_clips, length): .resize(width=W - 100) .set_opacity(float(opacity)), ) - if opacity is None or float(opacity) >= 1: # opacity not set or is set to one OR MORE + if ( + opacity is None or float(opacity) >= 1 + ): # opacity not set or is set to one OR MORE image_clips.insert( 0, ImageClip(f"assets/temp/png/title.png")