diff --git a/csv_loader.py b/csv_loader.py index 85debd8..3d034db 100644 --- a/csv_loader.py +++ b/csv_loader.py @@ -21,8 +21,8 @@ class ArtistsCSVLoader: """ artists = {"Error loading artists.csv, check the console": ["",""]} if not os.path.exists(artists_path): - print(f"""Error. No artists.csv found. Put your artists.csv in the comfyui\custom_nodes\ComfyUI-CSV-Loader\CSV folder of ComfyUI. Then press "Refresh". - Your current comfyui\custom_nodes\ComfyUI-CSV-Loader\CSV folder is: {folder_paths.base_path} + print(f"""Error. No artists.csv found. Put your artists.csv in the custom_nodes-ComfyUI_Loader-CSV directory of ComfyUI. Then press "Refresh". + Your current root directory is: {folder_paths.base_path} """) return artists try: @@ -30,15 +30,15 @@ class ArtistsCSVLoader: artists = [[x.replace('"', '').replace('\n','') for x in re.split(',(?=(?:[^"]*"[^"]*")*[^"]*$)', line)] for line in f.readlines()[1:]] artists = {x[0]: [x[1],x[2]] for x in artists} except Exception as e: - print(f"""Error loading artists.csv. Make sure it is in the comfyui\custom_nodes\ComfyUI-CSV-Loader\CSV folder of ComfyUI. Then press "Refresh". - Your current comfyui\custom_nodes\ComfyUI-CSV-Loader\CSV folder is: {folder_paths.base_path} + print(f"""Error loading artists.csv. Make sure it is in the custom_nodes-ComfyUI_Loader-CSV directory of ComfyUI. Then press "Refresh". + Your current root directory is: {folder_paths.base_path} Error: {e} """) return artists @classmethod def INPUT_TYPES(cls): - cls.artists_csv = cls.load_artists_csv(os.path.join(folder_paths.base_path, "custom_nodes\\ComfyUI-CSV_Loader\\CSV\\artists.csv")) + cls.artists_csv = cls.load_artists_csv(os.path.join(folder_paths.base_path, "custom_nodes\\ComfyUI-CSV-Loader\\CSV\\artists.csv")) return { "required": { "artists": (list(cls.artists_csv.keys()),), @@ -59,7 +59,7 @@ class ArtistsCSVLoader: class ArtmovementsCSVLoader: """ - Loads csv file with artmovements. + Loads csv file with artmovements. For migration purposes from automatic11111 webui. """ @staticmethod @@ -74,8 +74,8 @@ class ArtmovementsCSVLoader: """ artmovements = {"Error loading artmovements.csv, check the console": ["",""]} if not os.path.exists(artmovements_path): - print(f"""Error. No artmovements.csv found. Put your artmovements.csv in the comfyui\custom_nodes\ComfyUI-CSV-Loader\CSV folder of ComfyUI. Then press "Refresh". - Your current comfyui\custom_nodes\ComfyUI-CSV-Loader\CSV folder is: {folder_paths.base_path} + print(f"""Error. No artmovements.csv found. Put your artmovements.csv in the custom_nodes-ComfyUI_Loader-CSV directory of ComfyUI. Then press "Refresh". + Your current root directory is: {folder_paths.base_path} """) return artmovements try: @@ -83,15 +83,15 @@ class ArtmovementsCSVLoader: artmovements = [[x.replace('"', '').replace('\n','') for x in re.split(',(?=(?:[^"]*"[^"]*")*[^"]*$)', line)] for line in f.readlines()[1:]] artmovements = {x[0]: [x[1],x[2]] for x in artmovements} except Exception as e: - print(f"""Error loading artmovements.csv. Make sure it is in the comfyui\custom_nodes\ComfyUI-CSV-Loader\CSV folder of ComfyUI. Then press "Refresh". - Your current comfyui\custom_nodes\ComfyUI-CSV-Loader\CSV folder is: {folder_paths.base_path} + print(f"""Error loading artmovements.csv. Make sure it is in the custom_nodes-ComfyUI_Loader-CSV directory of ComfyUI. Then press "Refresh". + Your current root directory is: {folder_paths.base_path} Error: {e} """) return artmovements @classmethod def INPUT_TYPES(cls): - cls.artmovements_csv = cls.load_artmovements_csv(os.path.join(folder_paths.base_path, "custom_nodes\\ComfyUI-CSV_Loader\\CSV\\artmovements.csv")) + cls.artmovements_csv = cls.load_artmovements_csv(os.path.join(folder_paths.base_path, "custom_nodes\\ComfyUI-CSV-Loader\\CSV\\artmovements.csv")) return { "required": { "artmovements": (list(cls.artmovements_csv.keys()),), @@ -112,7 +112,7 @@ class ArtmovementsCSVLoader: class CharactersCSVLoader: """ - Loads csv file with characters. + Loads csv file with characters. For migration purposes from automatic11111 webui. """ @staticmethod @@ -127,8 +127,8 @@ class CharactersCSVLoader: """ characters = {"Error loading characters.csv, check the console": ["",""]} if not os.path.exists(characters_path): - print(f"""Error. No characters.csv found. Put your characters.csv in the comfyui\custom_nodes\ComfyUI-CSV-Loader\CSV folder of ComfyUI. Then press "Refresh". - Your current comfyui\custom_nodes\ComfyUI-CSV-Loader\CSV folder is: {folder_paths.base_path} + print(f"""Error. No characters.csv found. Put your characters.csv in the custom_nodes-ComfyUI_Loader-CSV directory of ComfyUI. Then press "Refresh". + Your current root directory is: {folder_paths.base_path} """) return characters try: @@ -136,15 +136,15 @@ class CharactersCSVLoader: characters = [[x.replace('"', '').replace('\n','') for x in re.split(',(?=(?:[^"]*"[^"]*")*[^"]*$)', line)] for line in f.readlines()[1:]] characters = {x[0]: [x[1],x[2]] for x in characters} except Exception as e: - print(f"""Error loading characters.csv. Make sure it is in the comfyui\custom_nodes\ComfyUI-CSV-Loader\CSV folder of ComfyUI. Then press "Refresh". - Your current comfyui\custom_nodes\ComfyUI-CSV-Loader\CSV folder is: {folder_paths.base_path} + print(f"""Error loading characters.csv. Make sure it is in the custom_nodes-ComfyUI_Loader-CSV directory of ComfyUI. Then press "Refresh". + Your current root directory is: {folder_paths.base_path} Error: {e} """) return characters @classmethod def INPUT_TYPES(cls): - cls.characters_csv = cls.load_characters_csv(os.path.join(folder_paths.base_path, "custom_nodes\\ComfyUI-CSV_Loader\\CSV\\characters.csv")) + cls.characters_csv = cls.load_characters_csv(os.path.join(folder_paths.base_path, "custom_nodes\\ComfyUI-CSV-Loader\\CSV\\characters.csv")) return { "required": { "characters": (list(cls.characters_csv.keys()),), @@ -164,7 +164,7 @@ class CharactersCSVLoader: class ColorsCSVLoader: """ - Loads csv file with colors. + Loads csv file with colors. For migration purposes from automatic11111 webui. """ @staticmethod @@ -179,8 +179,8 @@ class ColorsCSVLoader: """ colors = {"Error loading colors.csv, check the console": ["",""]} if not os.path.exists(colors_path): - print(f"""Error. No colors.csv found. Put your colors.csv in the comfyui\custom_nodes\ComfyUI-CSV-Loader\CSV folder of ComfyUI. Then press "Refresh". - Your current comfyui\custom_nodes\ComfyUI-CSV-Loader\CSV folder is: {folder_paths.base_path} + print(f"""Error. No colors.csv found. Put your colors.csv in the custom_nodes-ComfyUI_Loader-CSV directory of ComfyUI. Then press "Refresh". + Your current root directory is: {folder_paths.base_path} """) return colors try: @@ -188,8 +188,8 @@ class ColorsCSVLoader: colors = [[x.replace('"', '').replace('\n','') for x in re.split(',(?=(?:[^"]*"[^"]*")*[^"]*$)', line)] for line in f.readlines()[1:]] colors = {x[0]: [x[1],x[2]] for x in colors} except Exception as e: - print(f"""Error loading colors.csv. Make sure it is in the comfyui\custom_nodes\ComfyUI-CSV-Loader\CSV folder of ComfyUI. Then press "Refresh". - Your current comfyui\custom_nodes\ComfyUI-CSV-Loader\CSV folder is: {folder_paths.base_path} + print(f"""Error loading colors.csv. Make sure it is in the custom_nodes-ComfyUI_Loader-CSV directory of ComfyUI. Then press "Refresh". + Your current root directory is: {folder_paths.base_path} Error: {e} """) return colors @@ -212,11 +212,12 @@ class ColorsCSVLoader: def execute(self, colors): return (self.colors_csv[colors][0], self.colors_csv[colors][1]) + # COMPOSITION class CompositionCSVLoader: """ - Loads csv file with composition. + Loads csv file with composition. For migration purposes from automatic11111 webui. """ @staticmethod @@ -231,8 +232,8 @@ class CompositionCSVLoader: """ composition = {"Error loading composition.csv, check the console": ["",""]} if not os.path.exists(composition_path): - print(f"""Error. No composition.csv found. Put your composition.csv in the comfyui\custom_nodes\ComfyUI-CSV-Loader\CSV folder of ComfyUI. Then press "Refresh". - Your current comfyui\custom_nodes\ComfyUI-CSV-Loader\CSV folder is: {folder_paths.base_path} + print(f"""Error. No composition.csv found. Put your composition.csv in the custom_nodes-ComfyUI_Loader-CSV directory of ComfyUI. Then press "Refresh". + Your current root directory is: {folder_paths.base_path} """) return composition try: @@ -240,15 +241,15 @@ class CompositionCSVLoader: composition = [[x.replace('"', '').replace('\n','') for x in re.split(',(?=(?:[^"]*"[^"]*")*[^"]*$)', line)] for line in f.readlines()[1:]] composition = {x[0]: [x[1],x[2]] for x in composition} except Exception as e: - print(f"""Error loading composition.csv. Make sure it is in the comfyui\custom_nodes\ComfyUI-CSV-Loader\CSV folder of ComfyUI. Then press "Refresh". - Your current comfyui\custom_nodes\ComfyUI-CSV-Loader\CSV folder is: {folder_paths.base_path} + print(f"""Error loading composition.csv. Make sure it is in the custom_nodes-ComfyUI_Loader-CSV directory of ComfyUI. Then press "Refresh". + Your current root directory is: {folder_paths.base_path} Error: {e} """) return composition @classmethod def INPUT_TYPES(cls): - cls.composition_csv = cls.load_composition_csv(os.path.join(folder_paths.base_path, "custom_nodes\\ComfyUI-CSV_Loader\\CSV\\composition.csv")) + cls.composition_csv = cls.load_composition_csv(os.path.join(folder_paths.base_path, "custom_nodes\\ComfyUI-CSV-Loader\\CSV\\composition.csv")) return { "required": { "composition": (list(cls.composition_csv.keys()),), @@ -268,7 +269,7 @@ class CompositionCSVLoader: #LIGHTING class LightingCSVLoader: """ - Loads csv file with lighting. + Loads csv file with lighting. For migration purposes from automatic11111 webui. """ @staticmethod @@ -283,8 +284,8 @@ class LightingCSVLoader: """ lighting = {"Error loading lighting.csv, check the console": ["",""]} if not os.path.exists(lighting_path): - print(f"""Error. No lighting.csv found. Put your lighting.csv in the comfyui\custom_nodes\ComfyUI-CSV-Loader\CSV folder of ComfyUI. Then press "Refresh". - Your current comfyui\custom_nodes\ComfyUI-CSV-Loader\CSV folder is: {folder_paths.base_path} + print(f"""Error. No lighting.csv found. Put your lighting.csv in the custom_nodes-ComfyUI_Loader-CSV directory of ComfyUI. Then press "Refresh". + Your current root directory is: {folder_paths.base_path} """) return lighting try: @@ -292,15 +293,15 @@ class LightingCSVLoader: lighting = [[x.replace('"', '').replace('\n','') for x in re.split(',(?=(?:[^"]*"[^"]*")*[^"]*$)', line)] for line in f.readlines()[1:]] lighting = {x[0]: [x[1],x[2]] for x in lighting} except Exception as e: - print(f"""Error loading lighting.csv. Make sure it is in the comfyui\custom_nodes\ComfyUI-CSV-Loader\CSV folder of ComfyUI. Then press "Refresh". - Your current comfyui\custom_nodes\ComfyUI-CSV-Loader\CSV folder is: {folder_paths.base_path} + print(f"""Error loading lighting.csv. Make sure it is in the custom_nodes-ComfyUI_Loader-CSV directory of ComfyUI. Then press "Refresh". + Your current root directory is: {folder_paths.base_path} Error: {e} """) return lighting @classmethod def INPUT_TYPES(cls): - cls.lighting_csv = cls.load_lighting_csv(os.path.join(folder_paths.base_path, "custom_nodes\\ComfyUI-CSV_Loader\\CSV\\lighting.csv")) + cls.lighting_csv = cls.load_lighting_csv(os.path.join(folder_paths.base_path, "custom_nodes\\ComfyUI-CSV-Loader\\CSV\\lighting.csv")) return { "required": { "lighting": (list(cls.lighting_csv.keys()),), @@ -321,7 +322,7 @@ class LightingCSVLoader: class SettingsCSVLoader: """ - Loads csv file with settings. + Loads csv file with settings. For migration purposes from automatic11111 webui. """ @staticmethod @@ -336,8 +337,8 @@ class SettingsCSVLoader: """ settings = {"Error loading settings.csv, check the console": ["",""]} if not os.path.exists(settings_path): - print(f"""Error. No settings.csv found. Put your settings.csv in the comfyui\custom_nodes\ComfyUI-CSV-Loader\CSV folder of ComfyUI. Then press "Refresh". - Your current comfyui\custom_nodes\ComfyUI-CSV-Loader\CSV folder is: {folder_paths.base_path} + print(f"""Error. No settings.csv found. Put your settings.csv in the custom_nodes-ComfyUI_Loader-CSV directory of ComfyUI. Then press "Refresh". + Your current root directory is: {folder_paths.base_path} """) return settings try: @@ -345,15 +346,15 @@ class SettingsCSVLoader: settings = [[x.replace('"', '').replace('\n','') for x in re.split(',(?=(?:[^"]*"[^"]*")*[^"]*$)', line)] for line in f.readlines()[1:]] settings = {x[0]: [x[1],x[2]] for x in settings} except Exception as e: - print(f"""Error loading settings.csv. Make sure it is in the comfyui\custom_nodes\ComfyUI-CSV-Loader\CSV folder of ComfyUI. Then press "Refresh". - Your current comfyui\custom_nodes\ComfyUI-CSV-Loader\CSV folder is: {folder_paths.base_path} + print(f"""Error loading settings.csv. Make sure it is in the custom_nodes-ComfyUI_Loader-CSV directory of ComfyUI. Then press "Refresh". + Your current root directory is: {folder_paths.base_path} Error: {e} """) return settings @classmethod def INPUT_TYPES(cls): - cls.settings_csv = cls.load_settings_csv(os.path.join(folder_paths.base_path, "custom_nodes\\ComfyUI-CSV_Loader\\CSV\\settings.csv")) + cls.settings_csv = cls.load_settings_csv(os.path.join(folder_paths.base_path, "custom_nodes\\ComfyUI-CSV-Loader\\CSV\\settings.csv")) return { "required": { "settings": (list(cls.settings_csv.keys()),), @@ -374,7 +375,7 @@ class SettingsCSVLoader: class StylesCSVLoader: """ - Loads csv file with styles. + Loads csv file with styles. For migration purposes from automatic11111 webui. """ @staticmethod @@ -389,8 +390,8 @@ class StylesCSVLoader: """ styles = {"Error loading styles.csv, check the console": ["",""]} if not os.path.exists(styles_path): - print(f"""Error. No styles.csv found. Put your styles.csv in the comfyui\custom_nodes\ComfyUI-CSV-Loader\CSV folder of ComfyUI. Then press "Refresh". - Your current comfyui\custom_nodes\ComfyUI-CSV-Loader\CSV folder is: {folder_paths.base_path} + print(f"""Error. No styles.csv found. Put your styles.csv in the custom_nodes-ComfyUI_Loader-CSV directory of ComfyUI. Then press "Refresh". + Your current root directory is: {folder_paths.base_path} """) return styles try: @@ -398,15 +399,15 @@ class StylesCSVLoader: styles = [[x.replace('"', '').replace('\n','') for x in re.split(',(?=(?:[^"]*"[^"]*")*[^"]*$)', line)] for line in f.readlines()[1:]] styles = {x[0]: [x[1],x[2]] for x in styles} except Exception as e: - print(f"""Error loading styles.csv. Make sure it is in the comfyui\custom_nodes\ComfyUI-CSV-Loader\CSV folder of ComfyUI. Then press "Refresh". - Your current comfyui\custom_nodes\ComfyUI-CSV-Loader\CSV folder is: {folder_paths.base_path} + print(f"""Error loading styles.csv. Make sure it is in the custom_nodes-ComfyUI_Loader-CSV directory of ComfyUI. Then press "Refresh". + Your current root directory is: {folder_paths.base_path} Error: {e} """) return styles @classmethod def INPUT_TYPES(cls): - cls.styles_csv = cls.load_styles_csv(os.path.join(folder_paths.base_path, "custom_nodes\\ComfyUI-CSV_Loader\\CSV\\styles.csv")) + cls.styles_csv = cls.load_styles_csv(os.path.join(folder_paths.base_path, "custom_nodes\\ComfyUI-CSV-Loader\\CSV\\styles.csv")) return { "required": { "styles": (list(cls.styles_csv.keys()),), @@ -427,7 +428,7 @@ class StylesCSVLoader: class PositiveCSVLoader: """ - Loads csv file with positive. + Loads csv file with positive. For migration purposes from automatic11111 webui. """ @staticmethod @@ -442,8 +443,8 @@ class PositiveCSVLoader: """ positive = {"Error loading positive.csv, check the console": ["",""]} if not os.path.exists(positive_path): - print(f"""Error. No positive.csv found. Put your positive.csv in the comfyui\custom_nodes\ComfyUI-CSV-Loader\CSV folder of ComfyUI. Then press "Refresh". - Your current comfyui\custom_nodes\ComfyUI-CSV-Loader\CSV folder is: {folder_paths.base_path} + print(f"""Error. No positive.csv found. Put your positive.csv in the custom_nodes-ComfyUI_Loader-CSV directory of ComfyUI. Then press "Refresh". + Your current root directory is: {folder_paths.base_path} """) return positive try: @@ -451,15 +452,15 @@ class PositiveCSVLoader: positive = [[x.replace('"', '').replace('\n','') for x in re.split(',(?=(?:[^"]*"[^"]*")*[^"]*$)', line)] for line in f.readlines()[1:]] positive = {x[0]: [x[1],x[2]] for x in positive} except Exception as e: - print(f"""Error loading positive.csv. Make sure it is in the comfyui\custom_nodes\ComfyUI-CSV-Loader\CSV folder of ComfyUI. Then press "Refresh". - Your current comfyui\custom_nodes\ComfyUI-CSV-Loader\CSV folder is: {folder_paths.base_path} + print(f"""Error loading positive.csv. Make sure it is in the custom_nodes-ComfyUI_Loader-CSV directory of ComfyUI. Then press "Refresh". + Your current root directory is: {folder_paths.base_path} Error: {e} """) return positive @classmethod def INPUT_TYPES(cls): - cls.positive_csv = cls.load_positive_csv(os.path.join(folder_paths.base_path, "custom_nodes\\ComfyUI-CSV_Loader\\CSV\\positive.csv")) + cls.positive_csv = cls.load_positive_csv(os.path.join(folder_paths.base_path, "custom_nodes\\ComfyUI-CSV-Loader\\CSV\\positive.csv")) return { "required": { "positive": (list(cls.positive_csv.keys()),), @@ -480,7 +481,7 @@ class PositiveCSVLoader: class NegativeCSVLoader: """ - Loads csv file with negative. + Loads csv file with negative. For migration purposes from automatic11111 webui. """ @staticmethod @@ -495,8 +496,8 @@ class NegativeCSVLoader: """ negative = {"Error loading negative.csv, check the console": ["",""]} if not os.path.exists(negative_path): - print(f"""Error. No negative.csv found. Put your negative.csv in the comfyui\custom_nodes\ComfyUI-CSV-Loader\CSV folder of ComfyUI. Then press "Refresh". - Your current comfyui\custom_nodes\ComfyUI-CSV-Loader\CSV folder is: {folder_paths.base_path} + print(f"""Error. No negative.csv found. Put your negative.csv in the custom_nodes-ComfyUI_Loader-CSV directory of ComfyUI. Then press "Refresh". + Your current root directory is: {folder_paths.base_path} """) return negative try: @@ -504,15 +505,15 @@ class NegativeCSVLoader: negative = [[x.replace('"', '').replace('\n','') for x in re.split(',(?=(?:[^"]*"[^"]*")*[^"]*$)', line)] for line in f.readlines()[1:]] negative = {x[0]: [x[1],x[2]] for x in negative} except Exception as e: - print(f"""Error loading negative.csv. Make sure it is in the comfyui\custom_nodes\ComfyUI-CSV-Loader\CSV folder of ComfyUI. Then press "Refresh". - Your current comfyui\custom_nodes\ComfyUI-CSV-Loader\CSV folder is: {folder_paths.base_path} + print(f"""Error loading negative.csv. Make sure it is in the custom_nodes-ComfyUI_Loader-CSV directory of ComfyUI. Then press "Refresh". + Your current root directory is: {folder_paths.base_path} Error: {e} """) return negative @classmethod def INPUT_TYPES(cls): - cls.negative_csv = cls.load_negative_csv(os.path.join(folder_paths.base_path, "custom_nodes\\ComfyUI-CSV_Loader\\CSV\\negative.csv")) + cls.negative_csv = cls.load_negative_csv(os.path.join(folder_paths.base_path, "custom_nodes\\ComfyUI-CSV-Loader\\CSV\\negative.csv")) return { "required": { "negative": (list(cls.negative_csv.keys()),),