mirror of
https://git.datalinker.icu/ltdrdata/ComfyUI-Manager
synced 2025-12-10 06:34:24 +08:00
scanner.py fix
This commit is contained in:
parent
206f1e4c9d
commit
7894d67f86
19
scanner.py
19
scanner.py
@ -12,21 +12,18 @@ def scan_in_file(filename):
|
|||||||
pattern = r"NODE_CLASS_MAPPINGS\s*=\s*{([^}]*)}"
|
pattern = r"NODE_CLASS_MAPPINGS\s*=\s*{([^}]*)}"
|
||||||
regex = re.compile(pattern, re.MULTILINE | re.DOTALL)
|
regex = re.compile(pattern, re.MULTILINE | re.DOTALL)
|
||||||
|
|
||||||
matches = regex.findall(code)
|
|
||||||
if not matches:
|
|
||||||
return []
|
|
||||||
|
|
||||||
nodes = set()
|
nodes = set()
|
||||||
class_dict = {}
|
class_dict = {}
|
||||||
|
|
||||||
for match in matches:
|
|
||||||
dict_text = match
|
|
||||||
|
|
||||||
pattern2 = r'NODE_CLASS_MAPPINGS\["(.*?)"\]'
|
pattern2 = r'NODE_CLASS_MAPPINGS\["(.*?)"\]'
|
||||||
keys = re.findall(pattern2, code)
|
keys = re.findall(pattern2, code)
|
||||||
for key in keys:
|
for key in keys:
|
||||||
nodes.add(key)
|
nodes.add(key)
|
||||||
|
|
||||||
|
matches = regex.findall(code)
|
||||||
|
for match in matches:
|
||||||
|
dict_text = match
|
||||||
|
|
||||||
key_value_pairs = re.findall(r"\"([^\"]*)\"\s*:\s*([^,\n]*)", dict_text)
|
key_value_pairs = re.findall(r"\"([^\"]*)\"\s*:\s*([^,\n]*)", dict_text)
|
||||||
for key, value in key_value_pairs:
|
for key, value in key_value_pairs:
|
||||||
class_dict[key] = value.strip()
|
class_dict[key] = value.strip()
|
||||||
@ -144,7 +141,7 @@ def update_custom_nodes():
|
|||||||
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')
|
py_urls = get_py_urls_from_json('custom-node-list.json')
|
||||||
|
|
||||||
@ -156,7 +153,7 @@ def update_custom_nodes():
|
|||||||
try:
|
try:
|
||||||
download_url(url, ".tmp")
|
download_url(url, ".tmp")
|
||||||
except:
|
except:
|
||||||
print(f"[ERROR] Cannot downalod '{url}'")
|
print(f"[ERROR] Cannot download '{url}'")
|
||||||
|
|
||||||
return node_info
|
return node_info
|
||||||
|
|
||||||
@ -207,7 +204,7 @@ def gen_json(node_info):
|
|||||||
print("### ComfyUI Manager Node Scanner ###")
|
print("### ComfyUI Manager Node Scanner ###")
|
||||||
|
|
||||||
print("\n# Updating extensions\n")
|
print("\n# Updating extensions\n")
|
||||||
node_info = update_custom_nodes()
|
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(node_info)
|
gen_json(updated_node_info)
|
||||||
Loading…
x
Reference in New Issue
Block a user