Commit 55660a2c by PLN (Algolia)

fix(bridge): Armada launches into the catalog viz, not a dir listing

Clicking L'Armada served armada/ root → a file listing (felt broken). Point it
at armada/tide-table (where the viz lives) and open /triangle.html — same as
`tide.py serve`. Verified: /triangle.html → 200.

Also lands midimon.enrich() (note/velocity/controller→structured) + tests, the
parsing groundwork for the live MIDI dashboard panel.
parent 1eba89fc
...@@ -66,10 +66,12 @@ WEB = [ ...@@ -66,10 +66,12 @@ WEB = [
{"key": "foundry", "name": "The Foundry", "blurb": "URL → audio → stems → loops", {"key": "foundry", "name": "The Foundry", "blurb": "URL → audio → stems → loops",
"url": "http://127.0.0.1:8765/", "port": 8765, "url": "http://127.0.0.1:8765/", "port": 8765,
"cmd": ["python3", str(TIDAL / "tools/foundry/server.py"), "--port", "8765"]}, "cmd": ["python3", str(TIDAL / "tools/foundry/server.py"), "--port", "8765"]},
{"key": "armada", "name": "L'Armada", "blurb": "catalog · distribution · gigs", # Serve tide-table (the catalog viz lives there) and open triangle.html —
"url": "http://127.0.0.1:8731/", "port": 8731, # exactly what `tide.py serve` does. Serving armada/ root = a dir listing.
{"key": "armada", "name": "L'Armada", "blurb": "catalog · triangle viz · gigs",
"url": "http://127.0.0.1:8731/triangle.html", "port": 8731,
"cmd": ["python3", str(TIDAL / "armada/serve.py"), "cmd": ["python3", str(TIDAL / "armada/serve.py"),
"--dir", str(TIDAL / "armada"), "--port", "8731"]}, "--dir", str(TIDAL / "armada/tide-table"), "--port", "8731"]},
] ]
BY_KEY = {l["key"]: l for l in (*LAUNCHERS, *WEB)} BY_KEY = {l["key"]: l for l in (*LAUNCHERS, *WEB)}
......
...@@ -49,6 +49,23 @@ def parse_line(line: str) -> dict | None: ...@@ -49,6 +49,23 @@ def parse_line(line: str) -> dict | None:
return {"source": source, "event": event, "data": data, "ch": ch} return {"source": source, "event": event, "data": data, "ch": ch}
def enrich(ev: dict) -> dict:
"""Add structured fields parsed from `data` (note/velocity/controller/…).
One parsing source of truth — used by the CLI renderer and the web stream.
"""
out = dict(ev)
for key, pat in (("note", r"note (\d+)"), ("velocity", r"velocity (\d+)"),
("controller", r"controller (\d+)"), ("value", r"value (-?\d+)"),
("program", r"program (\d+)")):
m = re.search(pat, ev["data"])
if m:
out[key] = int(m.group(1))
if "note" in out:
out["note_name"] = note_name(out["note"])
return out
def _color(event: str) -> str: def _color(event: str) -> str:
e = event.lower() e = event.lower()
for kw, code in C.items(): for kw, code in C.items():
......
...@@ -36,3 +36,13 @@ def test_render_contains_event_and_notename(): ...@@ -36,3 +36,13 @@ def test_render_contains_event_and_notename():
ev = M.parse_line(" 28:0 Note on 0, note 60, velocity 100") ev = M.parse_line(" 28:0 Note on 0, note 60, velocity 100")
out = M.render(ev) out = M.render(ev)
assert "Note on" in out and "C4" in out assert "Note on" in out and "C4" in out
def test_enrich_note_and_velocity():
ev = M.enrich(M.parse_line(" 28:0 Note on 0, note 60, velocity 100"))
assert ev["note"] == 60 and ev["note_name"] == "C4" and ev["velocity"] == 100
def test_enrich_controller():
ev = M.enrich(M.parse_line(" 28:0 Control change 0, controller 74, value 64"))
assert ev["controller"] == 74 and ev["value"] == 64 and "note" not in ev
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment