Nodes/MKRShift_Nodes/Publish Copy At Index
ComfyUI Node

Publish Copy At Index

Pull one caption out of the deck by number

By criskb·Created 7 months ago·Updated 5 months ago· 0
Publish Copy At Index
    • variant_json
    • headline
    • caption
    • hashtags_csv
    deck_json
    index0

    A thin node with a clear job: MKRPublishCopyAtIndex takes the deck_json from MKRPublishCopyDeck and an index, and hands back that one caption variant as plain strings you can wire anywhere - a text field, a save node, a filename. It's the "select one of many" plumbing that makes a copy deck actually usable in a graph, where you can't just eyeball a list.

    What it's for

    The deck node produces a batch of caption variants; almost always you then want one per asset. Set the index, and out comes the headline, caption, and hashtags for that variant as separate outputs. Change the index and the same deck gives you a different caption - which is exactly how you'd route variant #1 to asset #1 and variant #2 to asset #2 in a loop or a per-shot workflow.

    How it works

    It parses deck_json (expecting the variants array that MKRPublishCopyDeck produces), clamps the index, and returns the selected variant. If the index is out of range or the JSON is malformed, it returns an empty variant plus a warning in the JSON rather than crashing - a "requested variant was not found" note is embedded in the variant_json output.

    Inputs and outputs

    Inputs: deck_json and index (default 0, zero-based - variant 1 is index 0). Outputs: variant_json (the full variant record), headline, caption, and hashtags_csv - everything you need to drop into a text widget or an asset manifest.

    Installing it

    Standard pack install:

    cd ComfyUI/custom_nodes
    git clone https://github.com/criskb/MKRShift_Nodes
    

    restart ComfyUI, or Manager → MKRShift_Nodes. No dependencies, no ffmpeg - pure JSON selection.

    Common issues

    The only real trap is feeding it a deck_json that isn't a copy-deck output - feed it a manifest or arbitrary JSON and it finds no variants key, returning the empty-warning variant that looks like "nothing happened." And remember the zero-based indexing: ask for index 1 and you're getting the second caption. If your captions seem shifted by one, that's it.

    CategoryMKRShift Nodes/Publish/Utils

    Inputs (2)

    NameTypeDefaultDescription
    deck_jsonSTRING
    indexINT00–99999

    Outputs (4)

    NameTypeDescription
    variant_jsonSTRING
    headlineSTRING
    captionSTRING
    hashtags_csvSTRING