Add /live/browser/list_children OSC endpoint
Allows clients to explore the browser tree by category and path, returning the names of child nodes at the given location. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -42,6 +42,9 @@ class BrowserHandler(AbletonOSCHandler):
|
||||
self._add("/live/browser/get/hotswap_target", self._get_hotswap_target)
|
||||
self._add("/live/browser/begin_hotswap", self._begin_hotswap)
|
||||
|
||||
# Path exploration
|
||||
self._add("/live/browser/list_children", self._list_children)
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
def _browser(self):
|
||||
@@ -118,6 +121,25 @@ class BrowserHandler(AbletonOSCHandler):
|
||||
logger.warning("stop_preview: %s", e)
|
||||
return None
|
||||
|
||||
def _list_children(self, params: tuple) -> Optional[tuple]:
|
||||
"""List children at a browser path. params: category [, path_part, ...]"""
|
||||
if not params:
|
||||
return None
|
||||
browser = self._browser()
|
||||
if browser is None:
|
||||
return None
|
||||
category = str(params[0])
|
||||
path = [str(p) for p in params[1:]]
|
||||
try:
|
||||
root = getattr(browser, category)
|
||||
node = _iter_items(root, path) if path else root
|
||||
if node is None:
|
||||
return None
|
||||
return tuple(child.name for child in node.children)
|
||||
except Exception as e:
|
||||
logger.warning("list_children %s/%s: %s", category, path, e)
|
||||
return None
|
||||
|
||||
def _get_hotswap_target(self, params: tuple) -> Optional[tuple]:
|
||||
browser = self._browser()
|
||||
if browser:
|
||||
|
||||
Reference in New Issue
Block a user