added validater , auto spacy model dowloader

pull/1671/head
electro199 2 years ago
parent 2ada32a84f
commit 65cc5a4074

2
.gitignore vendored

@ -244,4 +244,4 @@ video_creation/data/videos.json
video_creation/data/envvars.txt video_creation/data/envvars.txt
config.toml config.toml
video_creation/data/videos.json *.exe

@ -97,6 +97,7 @@ if __name__ == "__main__":
) )
if not config : if not config :
sys.exit() sys.exit()
if ( if (
not settings.config["settings"]["tts"]["tiktok_sessionid"] not settings.config["settings"]["tts"]["tiktok_sessionid"]
or settings.config["settings"]["tts"]["tiktok_sessionid"] == "" or settings.config["settings"]["tts"]["tiktok_sessionid"] == ""

@ -22,6 +22,9 @@ def ffmpeg_install_windows():
for file in os.listdir("ffmpeg/doc"): for file in os.listdir("ffmpeg/doc"):
os.remove(f"ffmpeg/doc/{file}") os.remove(f"ffmpeg/doc/{file}")
os.rmdir("ffmpeg/doc") 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.") print("FFmpeg installed successfully! Please restart your computer and then re-run the program.")
exit() exit()
except Exception as e: except Exception as e:
@ -58,9 +61,9 @@ def ffmpeg_install():
try: try:
# Try to run the FFmpeg command # Try to run the FFmpeg command
subprocess.run(['ffmpeg', '-version'], check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) subprocess.run(['ffmpeg', '-version'], check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
except FileNotFoundError as e:
if not os.path.exists("./results") : 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.') 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.') 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): ") resp = input("We can try to automatically install it for you. Would you like to do that? (y/n): ")
if resp.lower() == "y": if resp.lower() == "y":

@ -17,7 +17,7 @@ def posttextparser(obj,*,tried:bool=False) -> List[str]:
except OSError as e: except OSError as e:
if not tried: if not tried:
os.system("python -m spacy download en_core_web_sm") 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 ") 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 raise e

@ -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()
Loading…
Cancel
Save