summaryrefslogtreecommitdiffstats
path: root/packages/meshbay-node/src/meshbay_node/ops.py
diff options
context:
space:
mode:
Diffstat (limited to 'packages/meshbay-node/src/meshbay_node/ops.py')
-rw-r--r--packages/meshbay-node/src/meshbay_node/ops.py29
1 files changed, 21 insertions, 8 deletions
diff --git a/packages/meshbay-node/src/meshbay_node/ops.py b/packages/meshbay-node/src/meshbay_node/ops.py
index d439ec3..1da6928 100644
--- a/packages/meshbay-node/src/meshbay_node/ops.py
+++ b/packages/meshbay-node/src/meshbay_node/ops.py
@@ -728,14 +728,6 @@ async def set_enabled_apps(state: dict, group_id: str, apps: list[str]) -> dict:
set_by=state.get("node_user_id", ""))
ctx["enabled_apps"] = apps
log.info("Enabled apps for group %s: %s", group_id[:8], ",".join(sorted(apps)))
- if "music" in apps:
- # Music has no root of its own to key a sweep off (unlike
- # set_video_root's enrich_video_root_fn) — turning the app on at all
- # is the trigger, mirroring that same "sweep what's already there"
- # need (docs/musicbay.md §2.1, daemon._enrich_music_now).
- enrich_fn = state.get("enrich_music_now_fn")
- if enrich_fn:
- asyncio.ensure_future(enrich_fn(group_id))
return {"apps": apps, "group_id": group_id}
@@ -850,6 +842,27 @@ async def set_video_root(state: dict, group_id: str, path: str) -> dict:
return {"path": path, "group_id": group_id}
+async def set_audio_root(state: dict, group_id: str, path: str) -> dict:
+ """
+ Same shape as set_video_root above — the Music app's own entry point,
+ added later (docs/musicbay.md's original "no root, works over the
+ whole shared tree" simplification didn't hold up against a real messy
+ library). `path=""` clears it — the Music tab then asks for one to be
+ chosen before anything (including tag/cover enrichment) runs, rather
+ than defaulting to the whole shared index.
+ """
+ roster = _roster(state)
+ ctx = _group_ctx(state, group_id)
+ await roster.set_audio_root(group_id, path, set_by=state.get("node_user_id", ""))
+ ctx["audio_root"] = path
+ log.info("Music root for group %s: %r", group_id[:8], path)
+ if path:
+ enrich_fn = state.get("enrich_audio_root_fn")
+ if enrich_fn:
+ asyncio.ensure_future(enrich_fn(group_id))
+ return {"path": path, "group_id": group_id}
+
+
# ── Scan settings ────────────────────────────────────────────────────────────
async def set_scan_settings(state: dict, group_id: str, reconcile_interval_secs: float,