video_helper.gui module
Video Helper — minimal single-page GUI (“video bench”).
This module holds nothing but the self-contained HTML document served by the
FastAPI app at GET /gui (see video_helper.api). It is deliberately
build-step-free: one string of HTML + Tailwind (via CDN) + vanilla ES-module
JavaScript. There is no bundler, no framework, no npm: the whole page is a
static asset the API returns verbatim.
Where the words live
In the markup, in English. Each one is wrapped as {{_("…")}} in the HTML,
or listed in _JS_NAME_TO_SOURCE for the script, and
os_helper.Catalog translates it through the compiled gettext
catalogues under locales/ (CODING.md 21.3).
English is the msgid, so it needs no catalogue and cannot fall out of sync
with one; a string the French catalogue has not caught up with renders as
readable English instead of as a key. The cost is the mirror image: rewording
the English here orphans its French entry, and gettext would quietly serve the
English. That is what tests/test_gui_i18n.py exists to catch — it hands
every source string in this module to os_helper.Catalog.problems(), so
an orphaned translation is a red build rather than a half-reverted page.
The per-operation parameter labels stay out of the catalogue on purpose, and the locale file says why: each one names the form field the request actually carries, so the wire’s own spelling is what makes a field checkable against the API documentation.
render_gui() resolves a language and returns the finished page.
Why a separate module
Keeping the (long) HTML out of video_helper.api keeps the route
definitions readable and lets the AI Helpers suite share one GUI template:
swap the operation list and the per-operation form fields, keep the plumbing.
What the page does
Drop / pick a local video (kept entirely client-side until “Run”).
Choose one operation (validate / dimensions / duration / convert / chunk / black / compress / image-loop / concat / overlay / extract-audio / mux-audio / burn-subs / srt2vtt / extract-frames / extract-flow).
Reveal only the fields (and any extra file inputs) that operation needs.
POST a
multipart/form-datarequest to the SAME FastAPI endpoints the CLI surface uses: the GUI adds zero new server logic.Preview the input and the output side by side: a
<video>player for clips, an<img>for the odd still, a JSON dump for the read-only probes, and a download link for everything (single file, or a.zipfor the multi-fileextract-frames/srt2vttoperations).
- video_helper.gui.default_language()[source]
The language an unknown or absent
?lang=falls back to.- Return type:
- video_helper.gui.render_gui(lang='')[source]
Render the single-page GUI in the requested language.
- Parameters:
lang (str) – Two-letter language code. Anything without a compiled catalogue — including the empty string — falls back to
_DEFAULT_LANGUAGE, so an unknown?lang=never 500s.- Returns:
The complete HTML document for that language.
- Return type:
Examples
>>> "<!doctype html>" in render_gui("en") True >>> render_gui("tlh") == render_gui(default_language()) True