|
|
@ -10,6 +10,7 @@ from video_creation.voices import save_text_to_mp3
|
|
|
|
from video_creation.screenshot_downloader import download_screenshots_of_reddit_posts
|
|
|
|
from video_creation.screenshot_downloader import download_screenshots_of_reddit_posts
|
|
|
|
from video_creation.final_video import make_final_video
|
|
|
|
from video_creation.final_video import make_final_video
|
|
|
|
from utils.console import print_markdown, print_substep
|
|
|
|
from utils.console import print_markdown, print_substep
|
|
|
|
|
|
|
|
from setup_program import setup
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def main(subreddit_=None, background=None, filename=None, thread_link_=None):
|
|
|
|
def main(subreddit_=None, background=None, filename=None, thread_link_=None):
|
|
|
@ -40,13 +41,17 @@ def main(subreddit_=None, background=None, filename=None, thread_link_=None):
|
|
|
|
configured = True
|
|
|
|
configured = True
|
|
|
|
if not os.path.exists(".env"):
|
|
|
|
if not os.path.exists(".env"):
|
|
|
|
shutil.copy(".env.template", ".env")
|
|
|
|
shutil.copy(".env.template", ".env")
|
|
|
|
console.print("[red] Your .env file is invalid, or was never created. Standby.[/red]")
|
|
|
|
console.print(
|
|
|
|
|
|
|
|
"[bold red] Your .env file is invalid, or was never created. Standby.[/bold red]"
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
console.print("[bold green]Checking environment variables...")
|
|
|
|
console.print("[bold green]Checking environment variables...[/bol green]")
|
|
|
|
|
|
|
|
|
|
|
|
for val in REQUIRED_VALUES:
|
|
|
|
for val in REQUIRED_VALUES:
|
|
|
|
if not os.getenv(val):
|
|
|
|
if not os.getenv(val):
|
|
|
|
print_substep(f"Please set the variable \"{val}\" in your .env file.", style="bold red")
|
|
|
|
print_substep(
|
|
|
|
|
|
|
|
f"Please set the variable \"{val}\" in your .env file.", style="bold red"
|
|
|
|
|
|
|
|
)
|
|
|
|
configured = False
|
|
|
|
configured = False
|
|
|
|
|
|
|
|
|
|
|
|
if configured:
|
|
|
|
if configured:
|
|
|
@ -54,12 +59,11 @@ def main(subreddit_=None, background=None, filename=None, thread_link_=None):
|
|
|
|
float(os.getenv("OPACITY"))
|
|
|
|
float(os.getenv("OPACITY"))
|
|
|
|
except:
|
|
|
|
except:
|
|
|
|
console.print(
|
|
|
|
console.print(
|
|
|
|
f"[red]Please ensure that OPACITY is set between 0 and 1 in your .env file"
|
|
|
|
f"[bold red]Please ensure that OPACITY is between 0 and 1 in .env file.[/bold red]"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
configured = False
|
|
|
|
raise SystemExit()
|
|
|
|
exit()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log("[bold green]Enviroment Variables are set! Continuing...[/bold green]")
|
|
|
|
console.print("[bold green]Enviroment Variables are set! Continuing...[/bold green]")
|
|
|
|
|
|
|
|
|
|
|
|
reddit_object = get_subreddit_threads(subreddit_, thread_link_)
|
|
|
|
reddit_object = get_subreddit_threads(subreddit_, thread_link_)
|
|
|
|
length, number_of_comments = save_text_to_mp3(reddit_object)
|
|
|
|
length, number_of_comments = save_text_to_mp3(reddit_object)
|
|
|
@ -70,12 +74,12 @@ def main(subreddit_=None, background=None, filename=None, thread_link_=None):
|
|
|
|
)
|
|
|
|
)
|
|
|
|
download_background(background)
|
|
|
|
download_background(background)
|
|
|
|
chop_background_video(length)
|
|
|
|
chop_background_video(length)
|
|
|
|
final_video = make_final_video(number_of_comments, filename)
|
|
|
|
make_final_video(number_of_comments, filename)
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
console.print(
|
|
|
|
console.print(
|
|
|
|
"[red]Looks like you need to set your Reddit credentials in the .env file. "
|
|
|
|
"[bold red]Looks like you need to set your Reddit credentials in the .env file. "
|
|
|
|
+ "Please follow the instructions in the README.md file to set them up.[/red]"
|
|
|
|
+ "Please follow the instructions in the README.md file to set them up.[/bold red]"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
setup_ask = input("\033[1mLaunch setup wizard? [y/N] > \033[0m")
|
|
|
|
setup_ask = input("\033[1mLaunch setup wizard? [y/N] > \033[0m")
|
|
|
|
if setup_ask in ["y", "Y"]:
|
|
|
|
if setup_ask in ["y", "Y"]:
|
|
|
|
os.system("python3 setup.py")
|
|
|
|
setup()
|
|
|
|