mirror of
https://github.com/Comfy-Org/ComfyUI-Manager.git
synced 2025-12-18 19:03:06 +08:00
missing nodes installation support for "copy" type
This commit is contained in:
parent
9d31687d2c
commit
66fd5071cc
@ -49,7 +49,7 @@
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
* Currently, support is only provided for extension nodes that can be installed in the form of "git-clone".
|
* Currently, support is not available for custom nodes that can only be downloaded through civitai.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -16,7 +16,7 @@ sys.path.append('../..')
|
|||||||
from torchvision.datasets.utils import download_url
|
from torchvision.datasets.utils import download_url
|
||||||
|
|
||||||
# ensure .js
|
# ensure .js
|
||||||
print("### Loading: ComfyUI-Manager (V0.6.2)")
|
print("### Loading: ComfyUI-Manager (V0.6.3)")
|
||||||
|
|
||||||
comfy_path = os.path.dirname(folder_paths.__file__)
|
comfy_path = os.path.dirname(folder_paths.__file__)
|
||||||
custom_nodes_path = os.path.join(comfy_path, 'custom_nodes')
|
custom_nodes_path = os.path.join(comfy_path, 'custom_nodes')
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
48
scanner.py
48
scanner.py
@ -1,8 +1,8 @@
|
|||||||
import re
|
import re
|
||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
import sys
|
|
||||||
from git import Repo
|
from git import Repo
|
||||||
|
from torchvision.datasets.utils import download_url
|
||||||
|
|
||||||
|
|
||||||
def scan_in_file(filename):
|
def scan_in_file(filename):
|
||||||
@ -83,6 +83,21 @@ def get_git_urls_from_json(json_file):
|
|||||||
return git_clone_files
|
return git_clone_files
|
||||||
|
|
||||||
|
|
||||||
|
def get_py_urls_from_json(json_file):
|
||||||
|
with open(json_file) as file:
|
||||||
|
data = json.load(file)
|
||||||
|
|
||||||
|
custom_nodes = data.get('custom_nodes', [])
|
||||||
|
py_files = []
|
||||||
|
for node in custom_nodes:
|
||||||
|
if node.get('install_type') == 'copy':
|
||||||
|
files = node.get('files', [])
|
||||||
|
if files:
|
||||||
|
py_files.append(files[0])
|
||||||
|
|
||||||
|
return py_files
|
||||||
|
|
||||||
|
|
||||||
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(os.getcwd(), ".tmp", repo_name)
|
||||||
@ -116,9 +131,19 @@ def update_custom_nodes():
|
|||||||
name = os.path.basename(url)
|
name = os.path.basename(url)
|
||||||
if name.endswith(".git"):
|
if name.endswith(".git"):
|
||||||
name = name[:-4]
|
name = name[:-4]
|
||||||
|
|
||||||
node_info[name] = url
|
node_info[name] = url
|
||||||
clone_or_pull_git_repository(url)
|
clone_or_pull_git_repository(url)
|
||||||
|
|
||||||
|
py_urls = get_py_urls_from_json('custom-node-list.json')
|
||||||
|
|
||||||
|
for url in py_urls:
|
||||||
|
name = os.path.basename(url)
|
||||||
|
if name.endswith(".py"):
|
||||||
|
node_info[name] = url
|
||||||
|
|
||||||
|
download_url(url, ".tmp")
|
||||||
|
|
||||||
return node_info
|
return node_info
|
||||||
|
|
||||||
|
|
||||||
@ -136,13 +161,30 @@ def gen_json(node_info):
|
|||||||
dirname = os.path.basename(dirname)
|
dirname = os.path.basename(dirname)
|
||||||
|
|
||||||
if nodes != []:
|
if nodes != []:
|
||||||
|
nodes.sort()
|
||||||
|
|
||||||
git_url = node_info[dirname]
|
git_url = node_info[dirname]
|
||||||
data[git_url] = nodes
|
data[git_url] = nodes
|
||||||
|
|
||||||
|
for file in node_files:
|
||||||
|
nodes = scan_in_file(file)
|
||||||
|
|
||||||
|
if nodes != []:
|
||||||
|
nodes.sort()
|
||||||
|
|
||||||
|
file = os.path.basename(file)
|
||||||
|
url = node_info[file]
|
||||||
|
data[url] = nodes
|
||||||
|
|
||||||
json_path = f"extension-node-map.json"
|
json_path = f"extension-node-map.json"
|
||||||
with open(json_path, "w") as file:
|
with open(json_path, "w") as file:
|
||||||
json.dump(data, file, indent=4)
|
json.dump(data, file, indent=4, sort_keys=True)
|
||||||
|
|
||||||
|
|
||||||
|
print("### ComfyUI Manager Node Scanner ###")
|
||||||
|
|
||||||
|
print("\n# Updating extensions\n")
|
||||||
node_info = update_custom_nodes()
|
node_info = update_custom_nodes()
|
||||||
|
|
||||||
|
print("\n# 'extension-node-map.json' file is generated.\n")
|
||||||
gen_json(node_info)
|
gen_json(node_info)
|
||||||
Loading…
Reference in New Issue
Block a user