SP_CacheDirToKeys
Replay every saved video from a folder, without recomputing a frame
- keys_list
SP_CacheDirToKeys turns a folder of rendered files into a list of cache keys - and because that list comes out as a batch, ComfyUI runs the rest of your graph once per key. This is the "replay my saved jobs" node of the cache suite.
Here's the workflow it's built for. You render a batch of videos to output/selected. Each render gets cached under its job name by the pack's cache loaders. Later - same session or after a restart - you drop this node in, point it at that folder, and wire its keys_list into the cache lookups downstream. ComfyUI sees a list output and batch-executes the whole graph for each key in turn. Every job that's already cached hits the memory/disk tiers and skips rendering; only genuinely new or changed jobs recompute. You get an overnight-batch pattern: render once, then cheaply re-run composites or analysis over the results forever.
How it works
get_keys scans directory_path for files matching file_extension (default .mp4, * for everything), and applies the same cleanup the rest of the cache uses on each name: strip the extension, strip a trailing ComfyUI _00001-style counter, strip a _multi suffix, and dedupe. The output is declared OUTPUT_IS_LIST, and the source comment is refreshingly honest about it: "this magic turns the node into a batch generator for the entire graph."
Relative paths are resolved against ComfyUI's working directory, and if the folder doesn't exist it logs an error and returns an empty list rather than crashing.
The inputs that matter
- directory_path - the folder to scan, default
output/selected. - file_extension - the filter, default
.mp4; use*for all files.
Output is a single keys_list of strings.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/bananasss00/ComfyUI-SP-Nodes
restart, or install "SP-Nodes" via ComfyUI Manager. No extra dependencies for this node - it's os.listdir and a regex.
Where people get burned
The folder must exist; an empty or missing folder yields zero keys and the batch silently does nothing. And the cleanup assumes names came out of ComfyUI's render pipeline - if your files don't have standard _00001 counters, the keys it produces won't match the ones your loaders wrote, and every lookup misses. Check the actual .joblib filenames in the cache folder if replays aren't hitting.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| directory_path | STRING | output/selected | Folder with your sorted/selected videos. |
| file_extension | STRING | .mp4 | Filter by extension. Use '*' for all files. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| keys_list | STRING | — |