diff options
Diffstat (limited to 'packages/meshbay-node/src/meshbay_node/ops.py')
| -rw-r--r-- | packages/meshbay-node/src/meshbay_node/ops.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/packages/meshbay-node/src/meshbay_node/ops.py b/packages/meshbay-node/src/meshbay_node/ops.py index 1da6928..c9375b3 100644 --- a/packages/meshbay-node/src/meshbay_node/ops.py +++ b/packages/meshbay-node/src/meshbay_node/ops.py @@ -863,6 +863,30 @@ async def set_audio_root(state: dict, group_id: str, path: str) -> dict: return {"path": path, "group_id": group_id} +async def set_photo_roots(state: dict, group_id: str, roots: list[str]) -> dict: + """ + Which folder(s) are the Photos app's entry points for this group. Unlike + `set_video_root`/`set_audio_root`, the whole *set* is replaced in one + call (docs/photos.md §2.1) — signed once, same shape as + `set_enabled_apps`, rather than one op per root added/removed. + + Always fires a sweep, even to an empty list: a root just added needs its + existing contents enriched (nothing else re-visits already-indexed + entries), and a root just removed leaves its cache entries harmlessly + unused rather than needing any cleanup — re-sweeping the new set costs + nothing when it's empty. + """ + roster = _roster(state) + ctx = _group_ctx(state, group_id) + await roster.set_photo_roots(group_id, roots, set_by=state.get("node_user_id", "")) + ctx["photo_roots"] = roots + log.info("Photo roots for group %s: %s", group_id[:8], ", ".join(sorted(roots)) or "(none)") + enrich_fn = state.get("enrich_photo_roots_fn") + if enrich_fn: + asyncio.ensure_future(enrich_fn(group_id)) + return {"roots": roots, "group_id": group_id} + + # ── Scan settings ──────────────────────────────────────────────────────────── async def set_scan_settings(state: dict, group_id: str, reconcile_interval_secs: float, |