From 71ae7db4d7b53aad0d7ee70fcbb1c21d8ab1031d Mon Sep 17 00:00:00 2001 From: Callum Leslie Date: Wed, 22 Jun 2022 13:21:16 +0100 Subject: [PATCH] Remove debug statements --- TTS/TikTok.py | 2 +- TTS/engine_wrapper.py | 4 ++-- video_creation/background.py | 4 +++- video_creation/final_video.py | 20 ++++++++++++++++---- 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/TTS/TikTok.py b/TTS/TikTok.py index 874e8dd..27ba864 100644 --- a/TTS/TikTok.py +++ b/TTS/TikTok.py @@ -89,7 +89,7 @@ class TikTok: # TikTok Text-to-Speech Wrapper r = session.post( f"{self.URI_BASE}{voice}&req_text={text}&speaker_map_type=0" ) - print(r.text) + # print(r.text) vstr = [r.json()["data"]["v_str"]][0] b64d = base64.b64decode(vstr) diff --git a/TTS/engine_wrapper.py b/TTS/engine_wrapper.py index 2a560b0..ca297e1 100644 --- a/TTS/engine_wrapper.py +++ b/TTS/engine_wrapper.py @@ -83,7 +83,7 @@ class TTSEngine: idy = None for idy, text_cut in enumerate(split_text): - print(f"{idx}-{idy}: {text_cut}\n") + # print(f"{idx}-{idy}: {text_cut}\n") self.call_tts(f"{idx}-{idy}.part", text_cut) split_files.append(AudioFileClip(f"{self.path}/{idx}-{idy}.part.mp3")) CompositeAudioClip([concatenate_audioclips(split_files)]).write_audiofile( @@ -91,7 +91,7 @@ class TTSEngine: ) for i in range(0, idy + 1): - print(f"Cleaning up {self.path}/{idx}-{i}.part.mp3") + # print(f"Cleaning up {self.path}/{idx}-{i}.part.mp3") Path(f"{self.path}/{idx}-{i}.part.mp3").unlink() def call_tts(self, filename: str, text: str): diff --git a/video_creation/background.py b/video_creation/background.py index fb300e6..d1a7948 100644 --- a/video_creation/background.py +++ b/video_creation/background.py @@ -40,7 +40,9 @@ def download_background(): "assets/backgrounds", filename=f"{credit}-{filename}" ) - print_substep("Background videos downloaded successfully! 🎉", style="bold green") + print_substep( + "Background videos downloaded successfully! 🎉", style="bold green" + ) def chop_background_video(video_length): diff --git a/video_creation/final_video.py b/video_creation/final_video.py index 37b1ac2..7ca1d10 100755 --- a/video_creation/final_video.py +++ b/video_creation/final_video.py @@ -55,7 +55,9 @@ def make_final_video(number_of_clips, length): # add title to video image_clips = [] # Gather all images - 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("assets/temp/png/title.png") @@ -74,7 +76,9 @@ def make_final_video(number_of_clips, length): ) 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) @@ -100,7 +104,9 @@ def make_final_video(number_of_clips, length): # .set_opacity(float(opacity)), # ) # else: - image_concat = concatenate_videoclips(image_clips).set_position(("center", "center")) + image_concat = concatenate_videoclips(image_clips).set_position( + ("center", "center") + ) image_concat.audio = audio_composite final = CompositeVideoClip([background_clip, image_concat]) @@ -134,7 +140,13 @@ def make_final_video(number_of_clips, length): print_substep("the results folder didn't exist so I made it") os.mkdir("./results") - final.write_videofile("assets/temp/temp.mp4", fps=30, audio_codec="aac", audio_bitrate="192k") + final.write_videofile( + "assets/temp/temp.mp4", + fps=30, + audio_codec="aac", + audio_bitrate="192k", + verbose=False, + ) ffmpeg_tools.ffmpeg_extract_subclip( "assets/temp/temp.mp4", 0, length, targetname=f"results/{filename}" )