pull/280/head
iaacornus 3 years ago
parent 4221444b2c
commit 5d597ca9e8
No known key found for this signature in database
GPG Key ID: 281739AE7252598C

@ -75,10 +75,10 @@ def program_options():
elif args.setup: elif args.setup:
setup() setup()
else: else:
print_substep("Error occured!", style="bold red") print_substep("Error occured!", style_="bold red")
raise SystemExit() raise SystemExit()
except KeyboardInterrupt: except KeyboardInterrupt:
print_substep("\nOperation Aborted!", style="bold red") print_substep("\nOperation Aborted!", style_="bold red")
if __name__ == "__main__": if __name__ == "__main__":

@ -52,7 +52,7 @@ def main(
for val in REQUIRED_VALUES: for val in REQUIRED_VALUES:
if not os.getenv(val): if not os.getenv(val):
print_substep( print_substep(
f"Please set the variable \"{val}\" in your .env file.", style="bold red" f"Please set the variable \"{val}\" in your .env file.", style_="bold red"
) )
configured = False configured = False

@ -128,6 +128,6 @@ def get_subreddit_threads(subreddit_, thread_link_, number_of_comments):
except AttributeError: except AttributeError:
pass pass
print_substep("AskReddit threads retrieved successfully.", style="bold green") print_substep("AskReddit threads retrieved successfully.", style_="bold green")
return content return content

@ -31,7 +31,7 @@ def download_background(background):
background_check = os.path.isfile("assets/mp4/background.mp4") background_check = os.path.isfile("assets/mp4/background.mp4")
if background_check and background is not None: if background_check and background is not None:
print_substep( print_substep(
"Background video is already downloaded! Replacing ...", style="bold red" "Background video is already downloaded! Replacing ...", style_="bold red"
) )
os.remove("assets/mp4/background.mp4") os.remove("assets/mp4/background.mp4")
@ -49,21 +49,21 @@ def download_background(background):
) )
if check_link: if check_link:
print_substep(f"Downloading video from: {background}", style="bold") print_substep(f"Downloading video from: {background}", style_="bold")
ydl.download(background) ydl.download(background)
elif re.match(background[-4], "mp4"): elif re.match(background[-4], "mp4"):
print_substep(f"Using the given video file: {background}", style="bold") print_substep(f"Using the given video file: {background}", style_="bold")
os.replace(background.strip(), "assets/mp4/background.mp4") os.replace(background.strip(), "assets/mp4/background.mp4")
else: # if the link is not youtube link or a file else: # if the link is not youtube link or a file
raise ValueError raise ValueError
except ValueError: except ValueError:
print_substep("Invalid input!", style="bold red") print_substep("Invalid input!", style_="bold red")
except ConnectionError: except ConnectionError:
print_substep("There is a connection error!", style="bold red") print_substep("There is a connection error!", style_="bold red")
except DownloadError: except DownloadError:
print_substep("There is a download error!", style="bold red") print_substep("There is a download error!", style_="bold red")
else: else:
print_substep("Background video downloaded successfully!", style="bold green") print_substep("Background video downloaded successfully!", style_="bold green")
cancel = False cancel = False
if cancel: if cancel:
@ -82,4 +82,4 @@ def chop_background_video(video_length):
end_time, end_time,
targetname="assets/mp4/clip.mp4", targetname="assets/mp4/clip.mp4",
) )
print_substep("Background video chopped successfully!", style="bold green") print_substep("Background video chopped successfully!", style_="bold green")

@ -40,7 +40,7 @@ def make_final_video(number_of_clips, file_name):
TypeError TypeError
): ):
print_substep( print_substep(
"Please ensure that OPACITY is between 0 and 1 in .env file", style="bold red" "Please ensure that OPACITY is between 0 and 1 in .env file", style_="bold red"
) )
# Gather all audio clips # Gather all audio clips
@ -55,7 +55,7 @@ def make_final_video(number_of_clips, file_name):
OSError, OSError,
FileNotFoundError, FileNotFoundError,
): ):
print_substep("An error occured! Aborting.", style="bold red") print_substep("An error occured! Aborting.", style_="bold red")
raise SystemExit() raise SystemExit()
else: else:
audio_concat = concatenate_audioclips(audio_clips) audio_concat = concatenate_audioclips(audio_clips)

@ -59,4 +59,4 @@ def download_screenshots_of_reddit_posts(reddit_object, screenshot_num, theme):
f"#t1_{comment['comment_id']}" f"#t1_{comment['comment_id']}"
).screenshot(path=f"assets/png/comment_{idx}.png") ).screenshot(path=f"assets/png/comment_{idx}.png")
print_substep("Screenshots downloaded Successfully.", style="bold green") print_substep("Screenshots downloaded Successfully.", style_="bold green")

@ -51,6 +51,6 @@ def save_text_to_mp3(reddit_obj):
tts.save(f"assets/mp3/{idx}.mp3") tts.save(f"assets/mp3/{idx}.mp3")
length += MP3(f"assets/mp3/{idx}.mp3").info.length length += MP3(f"assets/mp3/{idx}.mp3").info.length
print_substep("Saved Text to MP3 files successfully.", style="bold green") print_substep("Saved Text to MP3 files successfully.", style_="bold green")
# ! Return the index so we know how many screenshots of comments we need to make. # ! Return the index so we know how many screenshots of comments we need to make.
return length, idx return length, idx

Loading…
Cancel
Save