Step 1: the settings page, read-only, live on NA Ingest at port 8020
Overview (problems in the room with the hold action, the live deck, one line per computer), Keys (both pages, what each key will say and what holding does), Computers (map with the keys that turn red, cards with a light per thing that runs there from the watchdog's snapshot and a read-only probe, Gear, Setup), Logs, History (the installer's copies for now), Help (four cards, the generated key guide, cheat sheet and Where things are, glossary, Companion facts), Site setup and Fixes read-only. The editing code is checked (with a lockout) but nothing can change yet. Also: faults are attributed to the computers their check is about; the installer refuses while a HyperDeck is recording (--now overrides); the Lighting PC's MIDI session is listed; the probes read sudo's answer correctly and expand $HOME outside the quotes. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
+34
-13
@@ -1,6 +1,7 @@
|
||||
"""The teaching pages, built from the config: "What each key does", the cheat sheet, "Where things are"."""
|
||||
import html
|
||||
import os
|
||||
import re
|
||||
|
||||
from settings import PARENT # noqa: F401
|
||||
import schema
|
||||
@@ -23,7 +24,7 @@ table { border-collapse: collapse; width: 100%; font-size: .95rem; } th, td { te
|
||||
|
||||
FAULT_WORDS = {
|
||||
"conn": ["NO ANSWER", "UNREACHABLE", "REFUSED", "LOGIN", "OFFLINE", "WARNING", "DISABLED", "NOT IN COMPANION", "NO DATA"],
|
||||
"hyperdeck": ["NO DISK", "FULL <minutes>", "LOW <minutes>", "NOT REC", "OFFLINE", "NO ANSWER"],
|
||||
"hyperdeck": ["NO DISK", "FULL (minutes left)", "LOW (minutes left)", "NOT REC", "OFFLINE", "NO ANSWER"],
|
||||
"dante": ["<device> GONE"], "shure": ["<channel> BATT", "<channel> INTERF"], "psm": ["<channel> RF MUTE"],
|
||||
"tascam": ["<the recorder's own error or caution>"], "ping": ["<name> NO PING"], "launchd": ["<name> NOT LOADED", "<name> STOPPED"],
|
||||
"process": ["<name> STOPPED"], "http": ["<name> UNREACH"], "disk": ["DISK <free>GB"],
|
||||
@@ -94,26 +95,46 @@ def fix_words(fix_id, cfg):
|
||||
return e(fix.get("label", fix_id)) if fix else e(fix_id)
|
||||
|
||||
|
||||
def plain(markup):
|
||||
"""The same words without tags or entities, for the page's JSON."""
|
||||
return html.unescape(re.sub(r"<[^>]+>", "", markup))
|
||||
|
||||
|
||||
def hold_words(tile, cfg):
|
||||
fixes = []
|
||||
always = tile.get("hold_always")
|
||||
fixes, per_sub = [], []
|
||||
for chk in tile.get("checks", []):
|
||||
fx = chk.get("fix")
|
||||
if isinstance(fx, dict) and len(set(fx.values())) == 1:
|
||||
fx = next(iter(fx.values())) # one fix for every sub-check: a plain fix
|
||||
if isinstance(fx, dict):
|
||||
for sub, f in fx.items():
|
||||
fixes.append("%s: %s" % ("for anything else" if sub == "*" else "for " + e(sub), fix_words(f, cfg)))
|
||||
if f == sp.DANTE_AUTO or sub == "*":
|
||||
per_sub.append(fix_words(f, cfg) if sub == "*" else "%s: %s" % (e(sub), fix_words(f, cfg)))
|
||||
else:
|
||||
per_sub.append("%s: %s" % (e(sub), fix_words(f, cfg)))
|
||||
elif fx:
|
||||
fixes.append(fix_words(fx, cfg))
|
||||
fixes.append(fx)
|
||||
elif chk["type"] in sp.RESTARTABLE and chk.get("conn"):
|
||||
fixes.append("reconnects Companion's %s connection" % e(chk["conn"]))
|
||||
out = []
|
||||
if tile.get("hold_always"):
|
||||
out.append("<b>also when the key is green:</b> " + fix_words(tile["hold_always"], cfg))
|
||||
seen = []
|
||||
fixes.append(sp.RESTART_CONNECTION + ":" + chk["conn"])
|
||||
words, seen = [], set()
|
||||
for f in fixes:
|
||||
if f not in seen:
|
||||
seen.append(f)
|
||||
if seen:
|
||||
out.append("fixes what is failing: " + "; ".join(seen))
|
||||
if f in seen:
|
||||
continue
|
||||
seen.add(f)
|
||||
if f.startswith(sp.RESTART_CONNECTION + ":"):
|
||||
words.append("reconnects Companion's %s connection" % e(f.split(":", 1)[1]))
|
||||
elif f == always:
|
||||
words.append(fix_words(f, cfg) + " <b>(also when the key is green)</b>")
|
||||
else:
|
||||
words.append(fix_words(f, cfg))
|
||||
if always and always not in seen:
|
||||
words.insert(0, fix_words(always, cfg) + " <b>(also when the key is green)</b>")
|
||||
out = []
|
||||
if words:
|
||||
out.append("; ".join(words))
|
||||
if per_sub:
|
||||
out.append("for a named device, " + "; ".join(dict.fromkeys(per_sub)))
|
||||
if tile.get("kind") == "network":
|
||||
out.append("clears a remembered network blip")
|
||||
if tile.get("members"):
|
||||
|
||||
Reference in New Issue
Block a user