From 6fb35a3a422bfaf612297f83a21179206da7ab4d Mon Sep 17 00:00:00 2001 From: SayanoAI <28544690+SayanoAI@users.noreply.github.com> Date: Tue, 11 Jun 2024 22:54:13 -0400 Subject: [PATCH] added ffmpeg installer --- custom_nodes/settings/downloader.py | 16 ++++++++++++++-- install.py | 11 +++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 install.py diff --git a/custom_nodes/settings/downloader.py b/custom_nodes/settings/downloader.py index f4c6f40..8bc3fb9 100644 --- a/custom_nodes/settings/downloader.py +++ b/custom_nodes/settings/downloader.py @@ -1,4 +1,6 @@ +import platform import re +import subprocess from typing import IO, List, Tuple import unicodedata import requests @@ -31,7 +33,7 @@ RVC_INDEX = [ "RVC/.index/added_IVF985_Flat_nprobe_1_Fuji_v2.index", "RVC/.index/Monika_v2_40k.index" ] -BASE_MODELS = ["hubert_base.pt", "rmvpe.pt"] +BASE_MODELS = ["content-vec-best.safetensors", "rmvpe.pt"] VITS_MODELS = ["VITS/pretrained_ljs.pth"] PRETRAINED_MODELS = [ "pretrained_v2/D48k.pth", @@ -132,4 +134,14 @@ def slugify_filepath(filepath): # Replace spaces and other unwanted characters with dashes filename = re.sub(r'[^a-z0-9.-]+', '-', filename) # Join the directory and the slugified filename - return os.path.join(directory, filename) \ No newline at end of file + return os.path.join(directory, filename) + +def download_ffmpeg(): + if platform.system() == "Windows": + link = f"{RVC_DOWNLOAD_LINK}ffmpeg.exe" + ffmpeg_path = os.path.join(os.getcwd(),"ffmpeg.exe") + if os.path.isfile(ffmpeg_path): return True + return download_file((ffmpeg_path, link)) + elif platform.system() == "Linux": + subprocess.check_call("apt update && apt install -y -qq ffmpeg espeak") + return True \ No newline at end of file diff --git a/install.py b/install.py new file mode 100644 index 0000000..de25d4b --- /dev/null +++ b/install.py @@ -0,0 +1,11 @@ + +from .custom_nodes.settings.downloader import download_ffmpeg +import subprocess + +if __name__=="__main__": + try: + subprocess.check_call("ffmpeg -version") + except Exception as error: + print(f"Unexpected error occured: {error}") + # downloads ffmpeg + download_ffmpeg() \ No newline at end of file