Nodes/Story JSON Nodes/Save Text Passthrough
ComfyUI Node

Save Text Passthrough

Save the story JSON to disk without breaking your graph

By stepan-bogatorjov·Created 6 months ago·Updated 2 months ago· 0
Save Text Passthrough
    • text
    ◄text—►
    ◄filename_prefixscene►
    ◄output_folder►
    ◄extensiontxt►
    ◄add_countertrue►

    SaveTextPassthrough is the disk-writer for the Story JSON Nodes pack (stepan-bogatorjov/comfy_scenes_json_node): it takes any string, writes it to a file in ComfyUI's output folder, and hands the same string back out of the other socket. It's the plumbing that turns an in-graph string (like a generated story script) into a real file on disk - while keeping the wire alive so downstream nodes still get the value.

    Why bother with the passthrough? Because in this pack the file's name matters. The default prefix scene and a .txt extension produce scene_00001.txt, and that's exactly the file StoryFinalCompile auto-detects when it wants subtitles - it reads scenes[].voiceover.text and scenes[].subtitles[].text out of it and burns them into the final video. Break the naming convention and the compiler quietly finds no story file and no subtitles.

    How it works

    Standard ComfyUI save pattern: resolve the output directory, optionally join an output_folder onto it, then write the string with a zero-padded counter (scene_00001.txt) that increments until it finds a free name. add_counter off writes a plain scene.txt instead (overwriting whatever's there). The prefix can contain a path, so subs/myscene nests the file inside a subfolder. The return value is the input text, byte for byte.

    The inputs that matter

    • text - anything from a string node to a MockSceneText reply to the real story generator.
    • filename_prefix - default scene. Keep it for the compiler to find the file; change it if you're saving something other than the story JSON.
    • extension - default txt. Loose enough that you can save .md or .json, but again, scene_*.txt is the convention the rest of the pack looks for.
    • output_folder - optional subfolder under output/.
    • add_counter - on by default; off means "overwrite the same filename every run".

    Install

    cd ComfyUI/custom_nodes
    git clone https://github.com/stepan-bogatorjov/comfy_scenes_json_node
    

    Restart ComfyUI (or install via ComfyUI Manager under "Story JSON Nodes"). No extra dependencies.

    Troubleshooting

    The file lands in ComfyUI/output/ by default - that's where the pack's compiler and archiver expect it, so don't point output_folder elsewhere if you want the pipeline to pick it up. And remember that with add_counter on, every run creates a new numbered file: if you rerun the same workflow ten times you get ten scene_*.txt files, and StoryFinalCompile takes the newest one. Rerun and forget, and the subtitles come from the last run, not the one you're looking at.

    Categorytext

    Inputs (5)

    NameTypeDefaultDescription
    textSTRING—
    filename_prefixSTRINGscene—
    output_folderSTRING—
    extensionSTRINGtxt—
    add_counterBOOLEANtrue—

    Outputs (1)

    NameTypeDescription
    textSTRING—