From fd0e39862c353bc47ead39cbb2ae8f44c5e92460 Mon Sep 17 00:00:00 2001 From: "juancarlos.cavero" Date: Tue, 25 Aug 2026 15:45:19 +0200 Subject: [PATCH] feat(layouts): dashboard layout selector, layouts=none, ranges survive a fast recut - Advanced options gain "vertical layout": auto (server default, AI picks per video), two speakers stacked, screen over presenter, or single crop only. Only a deliberate choice travels as `layouts`; remembered in localStorage like the hook settings. - `layouts=none` switches the picker off for one job even though the deployment runs AUTO_LAYOUT=1. - The fast rerender (cut without reframe) wrote no layout sidecar, so a stacked clip fell back to bottom captions after a trim. It now carries the canonical clip's ranges through the new cut (layout_ranges.remap). --- CLAUDE.md | 14 ++++++--- app.py | 6 ++++ dashboard/src/App.jsx | 2 ++ dashboard/src/components/MediaInput.jsx | 22 +++++++++++++ layout_ranges.py | 26 ++++++++++++++++ recut.py | 7 +++++ tests/test_layout_ranges.py | 41 +++++++++++++++++++++++++ 7 files changed, 114 insertions(+), 4 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 218ca43..dbfc88f 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -87,9 +87,13 @@ answers describe the paid product as free. ### Cómo se elige el layout `POST /api/process` acepta `layouts`: una lista (JSON) o cadena separada por -comas con `auto`, `split`, `screencast`, `speaker_cut`, `punch_in`. Cada nombre -enciende su variable de entorno para **ese** trabajo (`app.py:layout_env`); sin -`layouts` el pipeline se comporta exactamente como antes. +comas con `auto`, `split`, `screencast`, `speaker_cut`, `punch_in` y `none`. +Cada nombre enciende su variable de entorno para **ese** trabajo +(`app.py:layout_env`); `none` apaga el picker aunque prod corra con +`AUTO_LAYOUT=1` (recorte simple y nada más). Sin `layouts` manda el env del +despliegue, que desde el 25-ago-2026 es `AUTO_LAYOUT=1`. El dashboard lo expone +en opciones avanzadas ("vertical layout": auto / split / screencast / none, +`MediaInput.jsx`, recordado en `localStorage.os_layout`). `auto` activa `layout_picker.py`: **una** llamada a Gemini por vídeo de origen (no por clip) que elige entre `none` / `screencast` / `split`. Medido sobre el @@ -131,7 +135,9 @@ se desactiva porque el modelo diga `none`. `subtitles.generate_ass`), the one place they cover nobody; the render records which stretches are stacked in a `.layout.json` sidecar (`layout_ranges.py`) and every metadata writer copies it into the clip's - `layout_ranges`, so `/api/subtitle` finds it after a restyle too. Only the + `layout_ranges`, so `/api/subtitle` finds it after a restyle too. The fast + rerender (cut without reframe) carries the canonical clip's ranges through + the new cut (`layout_ranges.remap`, in `recut.perform_recut`). Only the ASS path can do this; SRT burns keep one alignment for the whole file. - **SCREENCAST / WIDE Modes** (`screencast_layout.py`, `SCREENCAST_LAYOUT=1`): for scenes whose meaning lives outside the centre. Gemini reports each range's diff --git a/app.py b/app.py index 61319bb..b07da65 100644 --- a/app.py +++ b/app.py @@ -1899,6 +1899,9 @@ def layout_env(requested): The special value "auto" hands the choice to Gemini (one call per video). It composes with explicit picks: layout_picker only ever adds, so asking for "auto,punch_in" means "decide the layout yourself, and punch in regardless". + "none" is the opposite: it switches the picker OFF for this job even when + the deployment runs with AUTO_LAYOUT=1, for the user who wants the plain + single crop and nothing clever. """ env = {} for name in requested or []: @@ -1906,6 +1909,9 @@ def layout_env(requested): if key == "auto": env["AUTO_LAYOUT"] = "1" continue + if key == "none": + env["AUTO_LAYOUT"] = "0" + continue var = LAYOUT_ENV.get(key) if not var: continue diff --git a/dashboard/src/App.jsx b/dashboard/src/App.jsx index 6fa7b0a..40cace6 100644 --- a/dashboard/src/App.jsx +++ b/dashboard/src/App.jsx @@ -779,6 +779,8 @@ function App() { // but the dashboard always states the user's choice. auto_hook: data.autoHook ? '1' : '0', auto_hook_style: data.autoHook ? (data.autoHookStyle || 'classic') : null, + // 'auto' is the server default, so only a deliberate choice travels. + layouts: data.layout && data.layout !== 'auto' ? data.layout : null, }; if (data.type === 'url') { diff --git a/dashboard/src/components/MediaInput.jsx b/dashboard/src/components/MediaInput.jsx index 8f84ca4..a516bca 100644 --- a/dashboard/src/components/MediaInput.jsx +++ b/dashboard/src/components/MediaInput.jsx @@ -30,6 +30,12 @@ export default function MediaInput({ onProcess, isProcessing }) { const [autoHookStyle, setAutoHookStyle] = useState(() => { try { return localStorage.getItem('os_auto_hook_style') || 'classic'; } catch { return 'classic'; } }); + // Layout: 'auto' lets the AI pick per video (server default); the others + // force one on so a podcast host who knows what they uploaded doesn't + // depend on the detector, and 'none' keeps the plain single crop. + const [layout, setLayout] = useState(() => { + try { return localStorage.getItem('os_layout') || 'auto'; } catch { return 'auto'; } + }); const infoRef = useRef(null); // Close the compatibility popover on any outside click. @@ -78,10 +84,12 @@ export default function MediaInput({ onProcess, isProcessing }) { clipMaxSeconds: clipMaxSeconds || null, autoHook, autoHookStyle, + layout, }; try { localStorage.setItem('os_auto_hook', autoHook ? '1' : '0'); localStorage.setItem('os_auto_hook_style', autoHookStyle); + localStorage.setItem('os_layout', layout); } catch { /* ignore */ } if (mode === 'url' && url) { onProcess({ type: 'url', payload: url, acknowledged: true, outputFormat, ...advanced }); @@ -286,6 +294,20 @@ export default function MediaInput({ onProcess, isProcessing }) { Targets, not guarantees: the AI returns fewer clips when the material doesn't hold them. Leave blank to let it decide.

+
+ vertical layout + +