From 6451b804fed3f94664d22d97b648f697ae7ff9ab Mon Sep 17 00:00:00 2001 From: Doctor Diffusion <139909432+DoctorDiffusion@users.noreply.github.com> Date: Sat, 23 Nov 2024 15:09:35 -0500 Subject: [PATCH] Add files via upload --- __init__.py | 19 +++++++++++++------ prompt_journal.py | 45 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 6 deletions(-) create mode 100644 prompt_journal.py diff --git a/__init__.py b/__init__.py index 971890f..19d1816 100644 --- a/__init__.py +++ b/__init__.py @@ -13,20 +13,27 @@ from .youtube_video_downloader import ( NODE_CLASS_MAPPINGS as YOUTUBE_VIDEO_DOWNLOADER_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS as YOUTUBE_VIDEO_DOWNLOADER_DISPLAY_MAPPINGS ) -from .video_prompt_generator import ( - VideoPromptGenerator, - NODE_CLASS_MAPPINGS as VIDEO_PROMPT_GENERATOR_MAPPINGS, - NODE_DISPLAY_NAME_MAPPINGS as VIDEO_PROMPT_GENERATOR_DISPLAY_MAPPINGS +from .reverse_frame_sequence import ( + ReverseFrameSequence, + NODE_CLASS_MAPPINGS as REVERSE_FRAME_SEQUENCE_MAPPINGS, + NODE_DISPLAY_NAME_MAPPINGS as REVERSE_FRAME_SEQUENCE_DISPLAY_MAPPINGS +) +from .prompt_journal import ( + PromptJournal, + NODE_CLASS_MAPPINGS as PROMPT_JOURNAL_MAPPINGS, + NODE_DISPLAY_NAME_MAPPINGS as PROMPT_JOURNAL_DISPLAY_MAPPINGS ) NODE_CLASS_MAPPINGS = { **FINAL_FRAME_SELECTOR_MAPPINGS, **VIDEO_MERGE_MAPPINGS, **YOUTUBE_VIDEO_DOWNLOADER_MAPPINGS, - **VIDEO_PROMPT_GENERATOR_MAPPINGS + **REVERSE_FRAME_SEQUENCE_MAPPINGS, + **PROMPT_JOURNAL_MAPPINGS } NODE_DISPLAY_NAME_MAPPINGS = { **FINAL_FRAME_SELECTOR_DISPLAY_MAPPINGS, **VIDEO_MERGE_DISPLAY_MAPPINGS, **YOUTUBE_VIDEO_DOWNLOADER_DISPLAY_MAPPINGS, - **VIDEO_PROMPT_GENERATOR_DISPLAY_MAPPINGS + **REVERSE_FRAME_SEQUENCE_DISPLAY_MAPPINGS, + **PROMPT_JOURNAL_DISPLAY_MAPPINGS } \ No newline at end of file diff --git a/prompt_journal.py b/prompt_journal.py new file mode 100644 index 0000000..226660a --- /dev/null +++ b/prompt_journal.py @@ -0,0 +1,45 @@ +class PromptJournal: + def __init__(self): + self.prompts = [""] + self.prompt_number = 0 + + @classmethod + def INPUT_TYPES(cls): + return { + "required": { + "prompts": ("STRING", {"multiline": True, "default": ""}), + "prompt_number": ("INT", {"default": 0, "min": 0, "step": 1}), + }, + } + + RETURN_TYPES = ("STRING", "STRING") + FUNCTION = "process" + CATEGORY = "MediaMixer" + + def process(self, prompts, prompt_number): + self.prompts = prompts.split('\n') + self.prompt_number = prompt_number + + # Filter out empty rows for prompt selection + non_empty_prompts = [prompt for prompt in self.prompts if prompt.strip()] + + # Wrap around the prompt_number if it's too high + effective_prompt_number = self.prompt_number % len(non_empty_prompts) + + # Get the selected prompt + prompt = non_empty_prompts[effective_prompt_number] + + # Join all prompts back into a single string, keeping empty rows + all_prompts = '\n'.join(self.prompts) + + return (prompt, all_prompts) + +# A dictionary that contains all nodes you want to export with their names +NODE_CLASS_MAPPINGS = { + "PromptJournal": PromptJournal +} + +# A dictionary that contains the friendly/humanly readable titles for the nodes +NODE_DISPLAY_NAME_MAPPINGS = { + "PromptJournal": "Prompt Journal" +}