|
|
|
@ -7,6 +7,8 @@ Setup Script for RedditVideoMakerBot
|
|
|
|
|
# Imports
|
|
|
|
|
import os
|
|
|
|
|
import time
|
|
|
|
|
|
|
|
|
|
from setuptools import setup
|
|
|
|
|
from utils.console import print_markdown
|
|
|
|
|
from utils.console import print_step
|
|
|
|
|
from utils.console import print_substep
|
|
|
|
@ -15,6 +17,8 @@ from utils.loader import Loader
|
|
|
|
|
from pathlib import Path
|
|
|
|
|
console = Console()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
|
setup_done = Path(".setup-done-before").is_file()
|
|
|
|
|
|
|
|
|
|
if setup_done == True:
|
|
|
|
@ -31,24 +35,8 @@ print_markdown(
|
|
|
|
|
"### You're in the setup wizard. Ensure you're supposed to be here, then type yes to continue. If you're not sure, type no to quit."
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# This Input is used to ensure the user is sure they want to continue.
|
|
|
|
|
ensureSetupIsRequired = input("Are you sure you want to continue? > ").casefold()
|
|
|
|
|
if ensureSetupIsRequired != "yes":
|
|
|
|
|
console.print("[red]Exiting...")
|
|
|
|
|
time.sleep(0.5)
|
|
|
|
|
exit()
|
|
|
|
|
else:
|
|
|
|
|
# Again, let them know they are about to erase all other setup data.
|
|
|
|
|
console.print("[bold red] This will overwrite your current settings. Are you sure you want to continue? [bold green]yes/no")
|
|
|
|
|
overwriteSettings = input("Are you sure you want to continue? > ").casefold()
|
|
|
|
|
if overwriteSettings != "yes":
|
|
|
|
|
console.print("[red]Abort mission! Exiting...")
|
|
|
|
|
time.sleep(0.5)
|
|
|
|
|
exit()
|
|
|
|
|
else:
|
|
|
|
|
# Once they confirm, move on with the script.
|
|
|
|
|
console.print("[bold green]Alright! Let's get started!")
|
|
|
|
|
time.sleep(1)
|
|
|
|
|
|
|
|
|
|
ensureSetup()
|
|
|
|
|
|
|
|
|
|
console.log("Ensure you have the following ready to enter:")
|
|
|
|
|
console.log("[bold green]Reddit Client ID")
|
|
|
|
@ -60,9 +48,12 @@ console.log("[bold green]Opacity (range of 0-1, decimals are OK)")
|
|
|
|
|
console.log("[bold green]Subreddit (without r/ or /r/)")
|
|
|
|
|
console.log("[bold green]Theme (light or dark)")
|
|
|
|
|
time.sleep(0.5)
|
|
|
|
|
console.print("[green]If you don't have these, please follow the instructions in the README.md file to set them up.")
|
|
|
|
|
console.print("[green]If you do have these, type yes to continue. If you dont, go ahead and grab those quickly and come back.")
|
|
|
|
|
confirmUserHasCredentials = input("Are you sure you have the credentials? > ").casefold()
|
|
|
|
|
console.print(
|
|
|
|
|
"[green]If you don't have these, please follow the instructions in the README.md file to set them up.")
|
|
|
|
|
console.print(
|
|
|
|
|
"[green]If you do have these, type yes to continue. If you dont, go ahead and grab those quickly and come back.")
|
|
|
|
|
confirmUserHasCredentials = input(
|
|
|
|
|
"Are you sure you have the credentials? > ").casefold()
|
|
|
|
|
if confirmUserHasCredentials != "yes":
|
|
|
|
|
console.print("[red]I don't understand that.")
|
|
|
|
|
console.print("[red]Exiting...")
|
|
|
|
@ -71,10 +62,16 @@ else:
|
|
|
|
|
console.print("[bold green]Alright! Let's get started!")
|
|
|
|
|
time.sleep(1)
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
setup()
|
|
|
|
|
|
|
|
|
|
Begin the setup process.
|
|
|
|
|
console.log("[bold green]Setup Complete! Returning...")
|
|
|
|
|
|
|
|
|
|
# Post-Setup: send message and try to run main.py again.
|
|
|
|
|
os.system("python3 main.py")
|
|
|
|
|
|
|
|
|
|
def setup():
|
|
|
|
|
"""
|
|
|
|
|
Begin the setup process.
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
console.log("Enter your credentials now.")
|
|
|
|
@ -112,11 +109,37 @@ with open('.env', 'a') as f:
|
|
|
|
|
f.write(f'OPACITY="{opacity}"\n')
|
|
|
|
|
|
|
|
|
|
with open('.setup-done-before', 'a') as f:
|
|
|
|
|
f.write("This file blocks the setup assistant from running again. Delete this file to run setup again.")
|
|
|
|
|
f.write(
|
|
|
|
|
"This file blocks the setup assistant from running again. Delete this file to run setup again.")
|
|
|
|
|
|
|
|
|
|
loader.stop()
|
|
|
|
|
|
|
|
|
|
console.log("[bold green]Setup Complete! Returning...")
|
|
|
|
|
|
|
|
|
|
# Post-Setup: send message and try to run main.py again.
|
|
|
|
|
os.system("python3 main.py")
|
|
|
|
|
def ensureSetup():
|
|
|
|
|
# This Input is used to ensure the user is sure they want to continue.
|
|
|
|
|
ensureSetupIsRequired = input(
|
|
|
|
|
"Are you sure you want to continue? > ").casefold()
|
|
|
|
|
if ensureSetupIsRequired != "yes":
|
|
|
|
|
console.print("[red]Exiting...")
|
|
|
|
|
time.sleep(0.5)
|
|
|
|
|
exit()
|
|
|
|
|
else:
|
|
|
|
|
# Again, let them know they are about to erase all other setup data.
|
|
|
|
|
console.print(
|
|
|
|
|
"[bold red] This will overwrite your current settings. Are you sure you want to continue? [bold green]yes/no")
|
|
|
|
|
overwriteSettings = input(
|
|
|
|
|
"Are you sure you want to continue? > ").casefold()
|
|
|
|
|
if overwriteSettings != "yes":
|
|
|
|
|
console.print("[red]Abort mission! Exiting...")
|
|
|
|
|
time.sleep(0.5)
|
|
|
|
|
exit()
|
|
|
|
|
else:
|
|
|
|
|
# Once they confirm, move on with the script.
|
|
|
|
|
console.print("[bold green]Alright! Let's get started!")
|
|
|
|
|
time.sleep(1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
|
main()
|
|
|
|
|