From a735f6079052e6e07d5fc2d7710a4667d15806b0 Mon Sep 17 00:00:00 2001 From: "Dr.Lt.Data" Date: Sun, 27 Oct 2024 23:46:38 +0900 Subject: [PATCH] provide addtional channels to the manager-core --- channels.list.template | 2 -- modules/manager_ext_core.py | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/channels.list.template b/channels.list.template index 9a8d6877..f9845d06 100644 --- a/channels.list.template +++ b/channels.list.template @@ -1,5 +1,3 @@ -default::https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main -recent::https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/node_db/new legacy::https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/node_db/legacy forked::https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/node_db/forked dev::https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/node_db/dev diff --git a/modules/manager_ext_core.py b/modules/manager_ext_core.py index 84899a84..1e5baf8f 100644 --- a/modules/manager_ext_core.py +++ b/modules/manager_ext_core.py @@ -4,6 +4,7 @@ import configparser import manager_core as core import cm_global from manager_util import * +import shutil import folder_paths from comfy.cli_args import args @@ -18,6 +19,26 @@ DEFAULT_CHANNEL = "https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/ma manager_ext_config_path = os.path.abspath(os.path.join(folder_paths.get_user_directory(), 'default', 'manager-ext.ini')) cached_config = None +manager_ext_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) +channel_list_path = os.path.join(manager_ext_path, 'channels.list') + + +def update_channel_dict(): + if not os.path.exists(channel_list_path): + shutil.copy(channel_list_path+'.template', channel_list_path) + + core.get_channel_dict() # for the loading + + with open(os.path.join(manager_ext_path, 'channels.list'), 'r') as file: + channels = file.read() + for x in channels.split('\n'): + channel_info = x.split("::") + if len(channel_info) == 2: + core.channel_dict[channel_info[0]] = channel_info[1] + + +update_channel_dict() + def get_current_preview_method(): if args.preview_method == latent_preview.LatentPreviewMethod.Auto: