Update main.py
Browse files
main.py
CHANGED
|
@@ -8,12 +8,23 @@
|
|
| 8 |
|
| 9 |
# comfyui 插件路径 /tmp/code/sd/ComfyUI/custom_nodes
|
| 10 |
|
| 11 |
-
print('
|
| 12 |
|
| 13 |
import os
|
| 14 |
import subprocess
|
| 15 |
|
| 16 |
subprocess.run('install aria2 -y', check=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
# 包含文件名和下载 URL 的列表,格式为 ['文件名:下载URL', ...]
|
| 18 |
#Lora下载
|
| 19 |
|
|
@@ -98,11 +109,48 @@ def download_mode(file_urls, download_dir='/tmp/code/sd/stable-diffusion-webui/m
|
|
| 98 |
download_aria2(file_name, download_dir, url)
|
| 99 |
except ValueError:
|
| 100 |
print(f'无效的文件 URL 格式: {file_url}')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
|
| 102 |
-
|
|
|
|
| 103 |
download_Lora(Lora_url)
|
| 104 |
download_embeddings(embeddings_url)
|
| 105 |
download_VAE(VAE_url)
|
| 106 |
download_mode(mode_url)
|
| 107 |
|
|
|
|
| 108 |
|
|
|
|
| 8 |
|
| 9 |
# comfyui 插件路径 /tmp/code/sd/ComfyUI/custom_nodes
|
| 10 |
|
| 11 |
+
print('--------------远程执行---------------------')
|
| 12 |
|
| 13 |
import os
|
| 14 |
import subprocess
|
| 15 |
|
| 16 |
subprocess.run('install aria2 -y', check=True)
|
| 17 |
+
#SD插件下载
|
| 18 |
+
git_sd = [
|
| 19 |
+
'https://slink.ltd/https://github.com/2575044704/stable-diffusion-webui-localization-zh_CN2.git', #汉化
|
| 20 |
+
'https://slink.ltd/https://github.com/AlUlkesh/stable-diffusion-webui-images-browser', #图库浏览器
|
| 21 |
+
]
|
| 22 |
+
#comfyui插件下载
|
| 23 |
+
git_comfyui = [
|
| 24 |
+
'https://slink.ltd/https://github.com/AIGODLIKE/AIGODLIKE-COMFYUI-TRANSLATION',#中文插件
|
| 25 |
+
'https://slink.ltd/https://github.com/talesofai/comfyui-browser'#查看器
|
| 26 |
+
]
|
| 27 |
+
|
| 28 |
# 包含文件名和下载 URL 的列表,格式为 ['文件名:下载URL', ...]
|
| 29 |
#Lora下载
|
| 30 |
|
|
|
|
| 109 |
download_aria2(file_name, download_dir, url)
|
| 110 |
except ValueError:
|
| 111 |
print(f'无效的文件 URL 格式: {file_url}')
|
| 112 |
+
def clone_repos_sd(repo_urls, clone_dir='/tmp/code/sd/stable-diffusion-webui/extensions'):
|
| 113 |
+
"""
|
| 114 |
+
克隆 GitHub 仓库到指定目录
|
| 115 |
+
参数:
|
| 116 |
+
repo_urls (list): GitHub 仓库 URL 列表
|
| 117 |
+
clone_dir (str): 克隆仓库的目标目录
|
| 118 |
+
"""
|
| 119 |
+
# 创建目标目录
|
| 120 |
+
os.makedirs(clone_dir, exist_ok=True)
|
| 121 |
+
for repo_url in repo_urls:
|
| 122 |
+
try:
|
| 123 |
+
repo_name = repo_url.rstrip('/').split('/')[-1]
|
| 124 |
+
clone_path = os.path.join(clone_dir, repo_name)
|
| 125 |
+
if os.path.exists(clone_path):
|
| 126 |
+
print(f'仓库 {repo_name} 已存在, URL: {repo_url}')
|
| 127 |
+
continue
|
| 128 |
+
|
| 129 |
+
subprocess.run(['git', 'clone', repo_url, clone_path], check=True)
|
| 130 |
+
print(f'已成功克隆仓库: {repo_name}')
|
| 131 |
+
except subprocess.CalledProcessError as e:
|
| 132 |
+
print(f'克隆 {repo_url} 失败: {e}')
|
| 133 |
+
def clone_repos_comfyui(repo_urls, clone_dir='/tmp/code/sd/ComfyUI/custom_nodes'):
|
| 134 |
+
os.makedirs(clone_dir, exist_ok=True)
|
| 135 |
+
for repo_url in repo_urls:
|
| 136 |
+
try:
|
| 137 |
+
repo_name = repo_url.rstrip('/').split('/')[-1]
|
| 138 |
+
clone_path = os.path.join(clone_dir, repo_name)
|
| 139 |
+
if os.path.exists(clone_path):
|
| 140 |
+
print(f'仓库 {repo_name} 已存在, URL: {repo_url}')
|
| 141 |
+
continue
|
| 142 |
+
|
| 143 |
+
subprocess.run(['git', 'clone', repo_url, clone_path], check=True)
|
| 144 |
+
print(f'已成功克隆仓库: {repo_name}')
|
| 145 |
+
except subprocess.CalledProcessError as e:
|
| 146 |
+
print(f'克隆 {repo_url} 失败: {e}')
|
| 147 |
|
| 148 |
+
clone_repos_sd(git_sd)
|
| 149 |
+
clone_repos_comfyui(git_comfyui)
|
| 150 |
download_Lora(Lora_url)
|
| 151 |
download_embeddings(embeddings_url)
|
| 152 |
download_VAE(VAE_url)
|
| 153 |
download_mode(mode_url)
|
| 154 |
|
| 155 |
+
|
| 156 |
|