|
|
@ -7,7 +7,22 @@ import concurrent |
|
|
|
|
|
|
|
|
|
|
|
builtin_nodes = set() |
|
|
|
builtin_nodes = set() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import sys |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# prepare temp dir |
|
|
|
|
|
|
|
if len(sys.argv) > 1: |
|
|
|
|
|
|
|
temp_dir = sys.argv[1] |
|
|
|
|
|
|
|
else: |
|
|
|
|
|
|
|
temp_dir = os.path.join(os.getcwd(), ".tmp") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if not os.path.exists(temp_dir): |
|
|
|
|
|
|
|
os.makedirs(temp_dir) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print(f"TEMP DIR: {temp_dir}") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# scan |
|
|
|
def scan_in_file(filename, is_builtin=False): |
|
|
|
def scan_in_file(filename, is_builtin=False): |
|
|
|
global builtin_nodes |
|
|
|
global builtin_nodes |
|
|
|
|
|
|
|
|
|
|
@ -143,7 +158,7 @@ def get_py_urls_from_json(json_file): |
|
|
|
|
|
|
|
|
|
|
|
def clone_or_pull_git_repository(git_url): |
|
|
|
def clone_or_pull_git_repository(git_url): |
|
|
|
repo_name = git_url.split("/")[-1].split(".")[0] |
|
|
|
repo_name = git_url.split("/")[-1].split(".")[0] |
|
|
|
repo_dir = os.path.join(os.getcwd(), ".tmp", repo_name) |
|
|
|
repo_dir = os.path.join(temp_dir, repo_name) |
|
|
|
|
|
|
|
|
|
|
|
if os.path.exists(repo_dir): |
|
|
|
if os.path.exists(repo_dir): |
|
|
|
try: |
|
|
|
try: |
|
|
@ -163,9 +178,8 @@ def clone_or_pull_git_repository(git_url): |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def update_custom_nodes(): |
|
|
|
def update_custom_nodes(): |
|
|
|
tmp_dir = os.path.join(os.getcwd(), ".tmp") |
|
|
|
if not os.path.exists(temp_dir): |
|
|
|
if not os.path.exists(tmp_dir): |
|
|
|
os.makedirs(temp_dir) |
|
|
|
os.makedirs(tmp_dir) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
node_info = {} |
|
|
|
node_info = {} |
|
|
|
|
|
|
|
|
|
|
@ -192,7 +206,7 @@ def update_custom_nodes(): |
|
|
|
node_info[name] = (url, title, node_pattern) |
|
|
|
node_info[name] = (url, title, node_pattern) |
|
|
|
|
|
|
|
|
|
|
|
try: |
|
|
|
try: |
|
|
|
download_url(url, ".tmp") |
|
|
|
download_url(url, temp_dir) |
|
|
|
except: |
|
|
|
except: |
|
|
|
print(f"[ERROR] Cannot download '{url}'") |
|
|
|
print(f"[ERROR] Cannot download '{url}'") |
|
|
|
|
|
|
|
|
|
|
@ -204,9 +218,9 @@ def update_custom_nodes(): |
|
|
|
|
|
|
|
|
|
|
|
def gen_json(node_info): |
|
|
|
def gen_json(node_info): |
|
|
|
# scan from .py file |
|
|
|
# scan from .py file |
|
|
|
node_files, node_dirs = get_nodes(".tmp") |
|
|
|
node_files, node_dirs = get_nodes(temp_dir) |
|
|
|
|
|
|
|
|
|
|
|
comfyui_path = os.path.abspath(os.path.join('.tmp', "ComfyUI")) |
|
|
|
comfyui_path = os.path.abspath(os.path.join(temp_dir, "ComfyUI")) |
|
|
|
node_dirs.remove(comfyui_path) |
|
|
|
node_dirs.remove(comfyui_path) |
|
|
|
node_dirs = [comfyui_path] + node_dirs |
|
|
|
node_dirs = [comfyui_path] + node_dirs |
|
|
|
|
|
|
|
|
|
|
@ -255,10 +269,10 @@ def gen_json(node_info): |
|
|
|
print(f"Missing info: {url}") |
|
|
|
print(f"Missing info: {url}") |
|
|
|
|
|
|
|
|
|
|
|
# scan from node_list.json file |
|
|
|
# scan from node_list.json file |
|
|
|
extensions = [name for name in os.listdir('.tmp') if os.path.isdir(os.path.join('.tmp', name))] |
|
|
|
extensions = [name for name in os.listdir(temp_dir) if os.path.isdir(os.path.join(temp_dir, name))] |
|
|
|
|
|
|
|
|
|
|
|
for extension in extensions: |
|
|
|
for extension in extensions: |
|
|
|
node_list_json_path = os.path.join('.tmp', extension, 'node_list.json') |
|
|
|
node_list_json_path = os.path.join(temp_dir, extension, 'node_list.json') |
|
|
|
if os.path.exists(node_list_json_path): |
|
|
|
if os.path.exists(node_list_json_path): |
|
|
|
git_url, title, node_pattern = node_info[extension] |
|
|
|
git_url, title, node_pattern = node_info[extension] |
|
|
|
|
|
|
|
|
|
|
@ -294,3 +308,4 @@ updated_node_info = update_custom_nodes() |
|
|
|
|
|
|
|
|
|
|
|
print("\n# 'extension-node-map.json' file is generated.\n") |
|
|
|
print("\n# 'extension-node-map.json' file is generated.\n") |
|
|
|
gen_json(updated_node_info) |
|
|
|
gen_json(updated_node_info) |
|
|
|
|
|
|
|
|
|
|
|