added validater , auto spacy model dowloader
This commit is contained in:
1 parent
2ada32a84f
commit
65cc5a4074
5 files changed
+27
-3
No files matched your search
+1
-1
@@ -244,4 +244,4 @@ video_creation/data/videos.json
|
||||
video_creation/data/envvars.txt
|
||||
|
||||
config.toml
|
||||
video_creation/data/videos.json
|
||||
*.exe
|
||||
@@ -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"] == ""
|
||||
|
||||
@@ -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":
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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()
|
||||
Reference in new issue
Block a user