Skip to main content

Module media_file_watcher

Module media_file_watcher 

Source
Expand description

Filesystem watcher for directories a Media pane is pointed at — detects new/changed media files (e.g. a freshly-downloaded ComfyUI render landing in a project’s clips/ folder) and pushes a per-block “a matching file changed” wake signal so panes update without a manual reload.

Migrated onto the shared fs_watch::FsWatchPool (SPEC_SHARED_FS_WATCHER_FRAMEWORK_2026_08_07.md), alongside editor_file_watcher.rs in the same PR. Directory-mode sibling of that file: that one watches individually-opened files (one entry per open tab); this one watches whole directories directly, filtered by a per-subscriber extension set, since a Media pane’s job is “show me the latest render in this folder,” not “watch this one exact file.”

Spec: docs/specs/SPEC_MEDIA_PANE_2026_07_26.md

Structs§

Inner 🔒
MediaFileWatcher

Constants§

DEBOUNCE 🔒
EVENT_MEDIA_FILE_CHANGED
MPS event fired when a file matching a Media pane’s extension filter is created/modified inside a directory that pane is watching. Scoped per-block (block:<id>) via MuxEvent::scopes, matching EVENT_EDITOR_FILE_CHANGED’s pattern. Payload is just the changed file’s path — a wake signal, not content; the frontend re-fetches via GET /agentmux/stream-local-file.

Functions§

publish_media_file_changed 🔒
Publish EVENT_MEDIA_FILE_CHANGED, scoped to every block watching the changed file’s directory with a matching extension. Mirrors publish_editor_file_changed’s per-block scoping — never a global broadcast.

Type Aliases§

DebounceGens 🔒
Per-file debounce generation counters, same collapsing-burst-writes purpose as editor_file_watcher.rs’s, keyed by the full changed-file path (not the directory) so unrelated files in the same watched directory debounce independently.