@ -6,7 +6,6 @@ from pathlib import Path
from subprocess import Popen
from subprocess import Popen
from typing import NoReturn
from typing import NoReturn
import ffmpeg
from prawcore import ResponseException
from prawcore import ResponseException
from utils . console import print_substep
from utils . console import print_substep
from reddit . subreddit import get_subreddit_threads
from reddit . subreddit import get_subreddit_threads
@ -62,7 +61,6 @@ def main(POST_ID=None) -> None:
make_final_video ( number_of_comments , length , reddit_object , bg_config )
make_final_video ( number_of_comments , length , reddit_object , bg_config )
def run_many ( times ) - > None :
def run_many ( times ) - > None :
for x in range ( 1 , times + 1 ) :
for x in range ( 1 , times + 1 ) :
print_step (
print_step (
@ -73,30 +71,24 @@ def run_many(times) -> None:
def shutdown ( ) - > NoReturn :
def shutdown ( ) - > NoReturn :
if " redditid " in globals ( ) :
if " redditid " in globals ( ) :
print_markdown ( " ## Clearing temp files " )
print_markdown ( " ## Clearing temp files " )
cleanup ( redditid )
cleanup ( redditid )
print ( " Exiting... " )
sys . exit ( )
print ( " Exiting... " )
print ( " Exiting... " )
sys . exit ( )
sys . exit ( )
if __name__ == " __main__ " :
if __name__ == " __main__ " :
if sys . version_info . major != 3 or sys . version_info . minor != 10 :
if sys . version_info . major != 3 or sys . version_info . minor != 10 :
print ( " Hey! Congratulations, you ' ve made it so far (which is pretty rare with no Python 3.10). Unfortunately, this program only works on Python 3.10. Please install Python 3.10 and try again. " )
print ( " Hey! Congratulations, you ' ve made it so far (which is pretty rare with no Python 3.10). Unfortunately, this program only works on Python 3.10. Please install Python 3.10 and try again. " )
sys . exit ( )
sys . exit ( )
ffmpeg_install ( ) # install ffmpeg if not installed
ffmpeg_install ( )
directory = Path ( ) . absolute ( )
directory = Path ( ) . absolute ( )
config = settings . check_toml (
config = settings . check_toml (
f " { directory } /utils/.config.template.toml " , f " { directory } /config.toml "
f " { directory } /utils/.config.template.toml " , f " { directory } /config.toml "
)
)
if not config :
config is False and sys . exit ( )
sys . exit ( )
if (
if (
not settings . config [ " settings " ] [ " tts " ] [ " tiktok_sessionid " ]
not settings . config [ " settings " ] [ " tts " ] [ " tiktok_sessionid " ]
@ -125,10 +117,8 @@ if __name__ == "__main__":
except KeyboardInterrupt :
except KeyboardInterrupt :
shutdown ( )
shutdown ( )
except ResponseException :
except ResponseException :
# error for invalid credentials
print_markdown ( " ## Invalid credentials " )
print_markdown ( " ## Invalid credentials " )
print_markdown ( " Please check your credentials in the config.toml file " )
print_markdown ( " Please check your credentials in the config.toml file " )
shutdown ( )
shutdown ( )
except Exception as err :
except Exception as err :
config [ " settings " ] [ " tts " ] [ " tiktok_sessionid " ] = " REDACTED "
config [ " settings " ] [ " tts " ] [ " tiktok_sessionid " ] = " REDACTED "