diff --git a/comfy_fm_newgen.py b/comfy_fm_newgen.py index 96c9d92..0effb6c 100644 --- a/comfy_fm_newgen.py +++ b/comfy_fm_newgen.py @@ -20,6 +20,8 @@ from comfy_api_simplified import ComfyApiWrapper, ComfyWorkflowWrapper logging.config.dictConfig(LOGGING_CONFIG) +cut = 1000 + # Load user configurations user_config = configparser.ConfigParser() try: @@ -126,7 +128,7 @@ def main(): # Parse the RTF file try: - rtf_file = rtf.parse_rtf(args.rtf_file)[:100] + rtf_file = rtf.parse_rtf(args.rtf_file)[:cut] logging.info(f"Parsed RTF file successfully. Found {len(rtf_file)} players.") except FileNotFoundError: logging.error(f"RTF file not found: {args.rtf_file}") diff --git a/rtf_research.py b/rtf_research.py new file mode 100644 index 0000000..7a9646a --- /dev/null +++ b/rtf_research.py @@ -0,0 +1,62 @@ +import sys +from lib.rtf_parser import RTF_Parser + +rtf = RTF_Parser() + +# Parse the RTF file +try: + rtf_file = rtf.parse_rtf("./Gen.rtf") +except FileNotFoundError: + print("Error: RTF file not found.") + sys.exit(1) + +# Extract unique values with examples +try: + unique_hair_length = {} + unique_hair_colour = {} + unique_skin_tone = {} + + for item in rtf_file: + try: + uid = item[0] + name = item[8] + hair_length = item[5] + hair_colour = item[6] + skin_tone = item[7] + + # Add examples for unique hair lengths + if hair_length not in unique_hair_length: + unique_hair_length[hair_length] = [] + if len(unique_hair_length[hair_length]) < 3: + unique_hair_length[hair_length].append({"UID": uid, "Name": name}) + + # Add examples for unique hair colours + if hair_colour not in unique_hair_colour: + unique_hair_colour[hair_colour] = [] + if len(unique_hair_colour[hair_colour]) < 3: + unique_hair_colour[hair_colour].append({"UID": uid, "Name": name}) + + # Add examples for unique skin tones + if skin_tone not in unique_skin_tone: + unique_skin_tone[skin_tone] = [] + if len(unique_skin_tone[skin_tone]) < 3: + unique_skin_tone[skin_tone].append({"UID": uid, "Name": name}) + + except IndexError: + continue # Skip rows with missing columns + + # Print sorted results + print("Hair Lengths with examples (sorted):") + for length in sorted(unique_hair_length.keys()): + print(f"{length}: {unique_hair_length[length]}") + + print("\nHair Colours with examples (sorted):") + for colour in sorted(unique_hair_colour.keys()): + print(f"{colour}: {unique_hair_colour[colour]}") + + print("\nSkin Tones with examples (sorted):") + for tone in sorted(unique_skin_tone.keys()): + print(f"{tone}: {unique_skin_tone[tone]}") + +except Exception as e: + print(f"An error occurred: {e}") \ No newline at end of file