mirror of
https://git.datalinker.icu/ltdrdata/ComfyUI-Manager
synced 2025-12-09 06:04:31 +08:00
scanner.py fix
This commit is contained in:
parent
206f1e4c9d
commit
7894d67f86
45
scanner.py
45
scanner.py
@ -12,37 +12,34 @@ 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)
|
||||||
|
|
||||||
key_value_pairs = re.findall(r"\"([^\"]*)\"\s*:\s*([^,\n]*)", dict_text)
|
|
||||||
for key, value in key_value_pairs:
|
|
||||||
class_dict[key] = value.strip()
|
|
||||||
|
|
||||||
for key, value in class_dict.items():
|
matches = regex.findall(code)
|
||||||
nodes.add(key)
|
for match in matches:
|
||||||
|
dict_text = match
|
||||||
update_pattern = r"NODE_CLASS_MAPPINGS.update\s*\({([^}]*)}\)"
|
|
||||||
update_match = re.search(update_pattern, code)
|
key_value_pairs = re.findall(r"\"([^\"]*)\"\s*:\s*([^,\n]*)", dict_text)
|
||||||
if update_match:
|
for key, value in key_value_pairs:
|
||||||
update_dict_text = update_match.group(1)
|
|
||||||
update_key_value_pairs = re.findall(r"\"([^\"]*)\"\s*:\s*([^,\n]*)", update_dict_text)
|
|
||||||
for key, value in update_key_value_pairs:
|
|
||||||
class_dict[key] = value.strip()
|
class_dict[key] = value.strip()
|
||||||
|
|
||||||
|
for key, value in class_dict.items():
|
||||||
nodes.add(key)
|
nodes.add(key)
|
||||||
|
|
||||||
|
update_pattern = r"NODE_CLASS_MAPPINGS.update\s*\({([^}]*)}\)"
|
||||||
|
update_match = re.search(update_pattern, code)
|
||||||
|
if update_match:
|
||||||
|
update_dict_text = update_match.group(1)
|
||||||
|
update_key_value_pairs = re.findall(r"\"([^\"]*)\"\s*:\s*([^,\n]*)", update_dict_text)
|
||||||
|
for key, value in update_key_value_pairs:
|
||||||
|
class_dict[key] = value.strip()
|
||||||
|
nodes.add(key)
|
||||||
|
|
||||||
return nodes
|
return nodes
|
||||||
|
|
||||||
def get_py_file_paths(dirname):
|
def get_py_file_paths(dirname):
|
||||||
@ -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