Skip to main content

Crate xil_web

Crate xil_web 

Source
Expand description

The xil gui web dashboard. Port of xil_gui.py, with Gradio replaced by axum and htmx.

The Python dashboard is a Gradio Blocks app with twelve tabs and three FastAPI routes the timeline editor calls. This crate serves the same tabs as server-rendered HTML, swapped in place by htmx, and keeps the three /xil/* JSON routes to their exact contracts, so a timeline written by either implementation’s xil daw --timeline-html works against either server.

What does not carry over is Gradio’s plumbing: /gradio_api/file= becomes a workspace file server under /ws/ (the timeline’s audio links are relative, so they resolve the same way), progress bars become htmx indicators, and generator callbacks become a job table streamed over server-sent events. Stages run as subprocesses of the Rust xil.

Modules§

activity
The optional session activity log (xil gui --output FILE).
audio
A bounded local copy of workspace audio, so playback of a NAS workspace reads the network once, and the “play all” concatenation preview.
configs
Config file listing, the workspace path boundary, and JSON load/save for the Project, Speakers, Cast Config and SFX Config tabs.
entries
The Dialogue sub-tab and the Timeline’s dialogue-edit modal: read, search and edit one dialogue line’s speaker and text in parsed/{slug}/parsed_{tag}.json.
episodes
Episode discovery, dropdown labels, the Episodes table and stem listing.
grades
The Audio Grading tab: SFX library grades kept in each MP3’s TXXX:XIL_GRADE frame, with a persisted (size, mtime) cache so a rescan of a NAS library is one walk plus stats.
html 🔒
Small HTML builders. Every value from disk or from a request goes through esc before it lands in markup.
pages 🔒
The dashboard page and the htmx fragments behind each tab.
parsed
The Edit Parsed JSON tab: load and save parsed/{slug}/parsed_{tag}.json for an episode chosen from the usual Episode dropdown.
runner
The Run Stage tab: command builders for each stage, extra-flag validation, and subprocess jobs whose merged output streams to the page.
scripts
The Scripts sub-tab: script listing, header analysis and save.
sfx_routes
The timeline editor’s JSON routes, with the contracts of _register_sfx_routes in xil_gui.py, plus two routes of our own for the Timeline’s dialogue-edit modal:

Structs§

AppState
Everything a handler needs. Workspace paths are read from the environment on each call, as the Python module does.
Choices
The dropdown lists every tab draws from. Listing configs and scripts crosses the network on a NAS workspace, so they are built once and rebuilt only on ⟳ Refresh or after something that can change them (a finished stage, a saved script) — as the Python app builds them at startup and refreshes them from the same events.
StageCells
Freshness glyphs for one Episodes-table row, from xil status’s engine.

Enums§

JobEvent
One line of a running stage’s output, or its exit.

Functions§

print_workspace_banner
_print_workspace_banner(): say which workspace this process is frozen to before anything else starts.
router
Every route the dashboard serves.
serve
Bind and serve until the process is stopped.

Type Aliases§

Rows
Episodes-table rows: tag, slug, title, then the five status cells.
StatusFn
_stage_status(slug, tag). The engine lives in the xil binary crate, so the binary hands it in.