diff --git a/.gitignore b/.gitignore index 5f4115f..41bdd5e 100644 --- a/.gitignore +++ b/.gitignore @@ -244,4 +244,4 @@ video_creation/data/videos.json video_creation/data/envvars.txt config.toml -video_creation/data/videos.json \ No newline at end of file +*.exe \ No newline at end of file diff --git a/main.py b/main.py index 23915a5..6d00658 100755 --- a/main.py +++ b/main.py @@ -97,6 +97,7 @@ if __name__ == "__main__": ) if not config : sys.exit() + if ( not settings.config["settings"]["tts"]["tiktok_sessionid"] or settings.config["settings"]["tts"]["tiktok_sessionid"] == "" diff --git a/utils/ffmpeg_install.py b/utils/ffmpeg_install.py index 930fc26..1be9522 100644 --- a/utils/ffmpeg_install.py +++ b/utils/ffmpeg_install.py @@ -22,6 +22,9 @@ def ffmpeg_install_windows(): for file in os.listdir("ffmpeg/doc"): os.remove(f"ffmpeg/doc/{file}") os.rmdir("ffmpeg/doc") + os.rmdir("ffmpeg/LICENSE.txt") + os.rmdir("ffmpeg/") + print("FFmpeg installed successfully! Please restart your computer and then re-run the program.") exit() except Exception as e: @@ -58,9 +61,9 @@ def ffmpeg_install(): try: # Try to run the FFmpeg command subprocess.run(['ffmpeg', '-version'], check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + except FileNotFoundError as e: if not os.path.exists("./results") : print('FFmpeg is installed on this system! If you are seeing this error for the second time, restart your computer.') - except FileNotFoundError as e: print('FFmpeg is not installed on this system.') resp = input("We can try to automatically install it for you. Would you like to do that? (y/n): ") if resp.lower() == "y": diff --git a/utils/posttextparser.py b/utils/posttextparser.py index e7f6840..d06fa06 100644 --- a/utils/posttextparser.py +++ b/utils/posttextparser.py @@ -17,7 +17,7 @@ def posttextparser(obj,*,tried:bool=False) -> List[str]: except OSError as e: if not tried: os.system("python -m spacy download en_core_web_sm") - return posttextparser(obj,tried) + return posttextparser(obj,tried=True) print_step(" The spacy model can't load. You need to install it with the command \npython -m spacy download en_core_web_sm ") raise e diff --git a/utils/validate.py b/utils/validate.py new file mode 100644 index 0000000..49df0f2 --- /dev/null +++ b/utils/validate.py @@ -0,0 +1,20 @@ +import sys +from typing import NoReturn + +from utils import settings +from utils.console import print_substep + + +def validat_env(obj) -> NoReturn | None: + """ + check for wrong + """ + if ( + settings.config["settings"]["tts"]["tiktok_sessionid"] == "" + and settings.config["settings"]["tts"]["voice_choice"] == "tiktok" + ): + print_substep( + "TikTok voice requires a sessionid! Check our documentation on how to obtain one.", + "bold red", + ) + sys.exit() \ No newline at end of file