diff --git a/main.py b/main.py index 6937cf8..43ba5e8 100644 --- a/main.py +++ b/main.py @@ -26,6 +26,26 @@ def main( required variables are set. If not, print a warning and launch the setup wizard. """ + # Banner may look bad or wrong in IDE/Text Editor, but looks perfect in CMD, BASH or ZSH + banner = """ + + ██████╗░███████╗██████╗░██████╗░██╗████████╗  ██╗░░░██╗██╗██████╗░███████╗░█████╗░ + ██╔══██╗██╔════╝██╔══██╗██╔══██╗██║╚══██╔══╝  ██║░░░██║██║██╔══██╗██╔════╝██╔══██╗ + ██████╔╝█████╗░░██║░░██║██║░░██║██║░░░██║░░░  ╚██╗░██╔╝██║██║░░██║█████╗░░██║░░██║ + ██╔══██╗██╔══╝░░██║░░██║██║░░██║██║░░░██║░░░  ░╚████╔╝░██║██║░░██║██╔══╝░░██║░░██║ + ██║░░██║███████╗██████╔╝██████╔╝██║░░░██║░░░  ░░╚██╔╝░░██║██████╔╝███████╗╚█████╔╝ + ╚═╝░░╚═╝╚══════╝╚═════╝░╚═════╝░╚═╝░░░╚═╝░░░  ░░░╚═╝░░░╚═╝╚═════╝░╚══════╝░╚════╝░ + + ███╗░░░███╗░█████╗░██╗░░██╗███████╗██████╗░ + ████╗░████║██╔══██╗██║░██╔╝██╔════╝██╔══██╗ + ██╔████╔██║███████║█████═╝░█████╗░░██████╔╝ + ██║╚██╔╝██║██╔══██║██╔═██╗░██╔══╝░░██╔══██╗ + ██║░╚═╝░██║██║░░██║██║░╚██╗███████╗██║░░██║ + ╚═╝░░░░░╚═╝╚═╝░░╚═╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝ + + """ + print(banner) + load_dotenv() REQUIRED_VALUES = [ diff --git a/reddit/subreddit.py b/reddit/subreddit.py index e74a385..b04ec7c 100644 --- a/reddit/subreddit.py +++ b/reddit/subreddit.py @@ -20,7 +20,7 @@ def get_subreddit_threads(subreddit_, thread_link_, number_of_comments): case since it is None, it would raise ValueError, thus defaulting to AskReddit. - Returns a list of threads from the AskReddit subreddit. + Returns a list of threads from the provided subreddit. """ global submission @@ -105,7 +105,16 @@ def get_subreddit_threads(subreddit_, thread_link_, number_of_comments): "The thread do not contain any comments. Searching for new one.", style_="bold" ) - print_substep(f"Video will be: [cyan]{submission.title}[/cyan] :thumbsup:") + upvotes = submission.score + ratio = submission.upvote_ratio * 100 + num_comments = submission.num_comments + + print_substep( + f"[bold]Video will be: [cyan]{submission.title}[/cyan] :thumbsup:\n" + + f"[blue] Thread has {upvotes} and upvote ratio of {ratio}%\n" + + f"And has a {num_comments}[/blue].\n" + ) + try: content["thread_url"] = submission.url diff --git a/video_creation/background.py b/video_creation/background.py index 74f1062..0dc9659 100644 --- a/video_creation/background.py +++ b/video_creation/background.py @@ -9,6 +9,8 @@ from moviepy.editor import VideoFileClip from utils.console import print_step, print_substep +import datetime + def get_start_and_end_times(video_length, length_of_clip): random_time = randrange(180, int(length_of_clip) - int(video_length)) @@ -71,13 +73,16 @@ def download_background(background): raise SystemExit() -def chop_background_video(video_length): +def chop_background_video(video_length, vidpath): print_step("Finding a spot in the background video to chop...") - background = VideoFileClip("assets/mp4/background.mp4") - + background = VideoFileClip(f"assets/mp4/{vidpath}.mp4") + if background.duration < video_length + 180: + print_substep("This video is too short.", style="red") + noerror = False + return noerror start_time, end_time = get_start_and_end_times(video_length, background.duration) ffmpeg_extract_subclip( - "assets/mp4/background.mp4", + f"assets/mp4/{vidpath}.mp4", start_time, end_time, targetname="assets/mp4/clip.mp4", diff --git a/video_creation/voices.py b/video_creation/voices.py index 7bb0213..6f226f5 100644 --- a/video_creation/voices.py +++ b/video_creation/voices.py @@ -7,7 +7,6 @@ from rich.progress import track from utils.console import print_step, print_substep - def save_text_to_mp3(reddit_obj): """Saves Text to MP3 files.