forge
Explore
Log in

Don't you dare go Hollow

Merge branch 'worktree-agent-a30633220ef939f53'

Browse files at this commit

5e44881d2a3d708de10f9cddb5699a13e44e762cAhmet Kaan GümüşParent: ac2e8109776376
MCP.mdmodified+2 -1
@@ -412,7 +412,8 @@ Piper's stderr is reported on failure.
412 | `proxies` | action (`status`, the default, `make`, `cancel` or `delete`), source (`src:<n>`, a list or `"all"`) | the editing copies (proxies) of sources. `status` shows each source's state (ready, making with its percent, off, not needed for a sound or still, or why a stand-in failed). `make` starts one in the background and turns that film's switch back on; a film that plays at speed on this machine needs none, and says so. `cancel` stops one being made and leaves the film off, as the Proxies switch on a library row does. `delete` removes the stand-in and keeps the film off. With `auto_proxies` on, each `media_import` starts its stand-ins the same way |412 | `proxies` | action (`status`, the default, `make`, `cancel` or `delete`), source (`src:<n>`, a list or `"all"`) | the editing copies (proxies) of sources. `status` shows each source's state (ready, making with its percent, off, not needed for a sound or still, or why a stand-in failed). `make` starts one in the background and turns that film's switch back on; a film that plays at speed on this machine needs none, and says so. `cancel` stops one being made and leaves the film off, as the Proxies switch on a library row does. `delete` removes the stand-in and keeps the film off. With `auto_proxies` on, each `media_import` starts its stand-ins the same way |
413 | `speech_model` | download (false), model (`tiny`, `base` or `small`; default `base`), cancel (false) | the speech model that `transcript`, `find_words` and `auto_captions` run on: no argument shows which models are installed and the download in progress. `download: true` fetches a model in the background (the GUI's Download model fetches `base`); `cancel: true` stops it and keeps the files fetched so far. Nothing is downloaded unless `download` is true |413 | `speech_model` | download (false), model (`tiny`, `base` or `small`; default `base`), cancel (false) | the speech model that `transcript`, `find_words` and `auto_captions` run on: no argument shows which models are installed and the download in progress. `download: true` fetches a model in the background (the GUI's Download model fetches `base`); `cancel: true` stops it and keeps the files fetched so far. Nothing is downloaded unless `download` is true |
414 | `export_status` | job, out | a queued job (`export_start {queue:true}`) reads `waiting` with the number of exports ahead of it; progress, elapsed, ETA, encoder, outcome of one job; while a stabilised clip is measured before it can encode, the line and `stage`/`stage_progress` name that stage (`Measuring shake`) with its own percent; `out` reports a file this session did not start; omitted, every export so far, with its size when done (decimal: 12,139,083 bytes is 12.1 MB) and the integrated loudness (LUFS) and true peak of the written file (`integrated_lufs`, `true_peak_dbtp`, measured once from the file with the `loudness` measurement), or its error when failed. When a job finishes, a peak over the format's ceiling gets a warning line: -1 dBTP for lossless (wav, flac), -2 dBTP for lossy (the rest, since encoding can overshoot the mix) |414 | `export_status` | job, out | a queued job (`export_start {queue:true}`) reads `waiting` with the number of exports ahead of it; progress, elapsed, ETA, encoder, outcome of one job; while a stabilised clip is measured before it can encode, the line and `stage`/`stage_progress` name that stage (`Measuring shake`) with its own percent; `out` reports a file this session did not start; omitted, every export so far, with its size when done (decimal: 12,139,083 bytes is 12.1 MB) and the integrated loudness (LUFS) and true peak of the written file (`integrated_lufs`, `true_peak_dbtp`, measured once from the file with the `loudness` measurement), or its error when failed. When a job finishes, a peak over the format's ceiling gets a warning line: -1 dBTP for lossless (wav, flac), -2 dBTP for lossy (the rest, since encoding can overshoot the mix) |
415-| `export_cancel` | job, all | cancels a running job; a waiting (queued) job is removed from the queue and never starts. `all: true` cancels every unfinished export at once (the queued ones and the running one), as the export queue's Cancel all does. The queue's Pause and Start are not offered here: the MCP queue starts each job as the one before it ends, with no pause state to reach |415+| `export_cancel` | job, all | cancels a running job; a waiting (queued) job is removed from the queue and never starts. `all: true` cancels every unfinished export at once (the queued ones and the running one), as the export queue's Cancel all does. |
416+| `export_queue` | action (`pause`, `start` or `status`, the default) | `pause` stops the queue after the running export: the running one finishes, and the queued exports (`export_start {queue:true}`) stay waiting. `start` lifts the pause and starts the next queued export now if nothing is running. `status` says whether the queue is paused, the running export and the queued ones in order. A pause holds only queued exports; a direct export (no `queue`) starts at once. `export_status` names a paused queue |
416 | `render_preview` | range (`"all"`, the default, or `{from, to}`), cancel, clear | `clear: true` deletes every render file in the cache (finished or half written) and says how many went, as File > Delete render files does; refused while a render is running. Pre-renders a stretch of the timeline at preview size into the render cache, so playback over it reads finished frames instead of compositing them (heavy sections: stacked effects, titles over video, colour, speed, multicam). One render at a time, in the background; `project_status` shows the progress and the cached ranges. A render is keyed by a hash of everything that changes its pixels (the clips overlapping it and their neighbours, their sources, titles, captions, tone, rate), so an edit inside a cached range drops it and playback composes live there again. `cancel: true` stops the running render and removes its partial file. The sound is not rendered; the live mix always plays |417 | `render_preview` | range (`"all"`, the default, or `{from, to}`), cancel, clear | `clear: true` deletes every render file in the cache (finished or half written) and says how many went, as File > Delete render files does; refused while a render is running. Pre-renders a stretch of the timeline at preview size into the render cache, so playback over it reads finished frames instead of compositing them (heavy sections: stacked effects, titles over video, colour, speed, multicam). One render at a time, in the background; `project_status` shows the progress and the cached ranges. A render is keyed by a hash of everything that changes its pixels (the clips overlapping it and their neighbours, their sources, titles, captions, tone, rate), so an edit inside a cached range drops it and playback composes live there again. `cancel: true` stops the running render and removes its partial file. The sound is not rendered; the live mix always plays |
417 418
418 `format` is one of `mp4`, `av1`, `av1-mp4`, `hevc`, `hevc-mp4`, `webm`, `wav`,419 `format` is one of `mp4`, `av1`, `av1-mp4`, `hevc`, `hevc-mp4`, `webm`, `wav`,
crates/mcp/src/help.rsmodified+2 -1
@@ -42,7 +42,7 @@ const GROUPS: &[(&str, &[&str])] = &[
42 ("scan", &["scenes", "stabilize_status", "track", "track_status"]),42 ("scan", &["scenes", "stabilize_status", "track", "track_status"]),
43 ("hear", &["levels", "silence", "cut_silence", "loudness", "normalize", "clean_voice"]),43 ("hear", &["levels", "silence", "cut_silence", "loudness", "normalize", "clean_voice"]),
44 ("edit", &["edit", "sequence", "multicam_create", "multicam_flatten", "effect", "undo", "redo", "checkpoint", "restore", "checkpoints"]),44 ("edit", &["edit", "sequence", "multicam_create", "multicam_flatten", "effect", "undo", "redo", "checkpoint", "restore", "checkpoints"]),
45- ("export", &["export_start", "export_presets", "export_status", "export_cancel", "export_captions", "render_preview"]),45+ ("export", &["export_start", "export_presets", "export_status", "export_cancel", "export_queue", "export_captions", "render_preview"]),
46 ("listen", &["transcript", "find_words", "auto_captions", "speech_model"]),46 ("listen", &["transcript", "find_words", "auto_captions", "speech_model"]),
47 ("captions", &["captions"]),47 ("captions", &["captions"]),
48 ("speak", &["voices", "voiceover"]),48 ("speak", &["voices", "voiceover"]),
@@ -261,6 +261,7 @@ EXPORT
261 The export keeps running while you do other things. If the client closes the server's input, the server waits for running exports to finish before it exits. A stop signal (SIGTERM or SIGINT) cancels them and deletes their partial files. Poll export_status until it finishes; export_cancel {job} stops one.261 The export keeps running while you do other things. If the client closes the server's input, the server waits for running exports to finish before it exits. A stop signal (SIGTERM or SIGINT) cancels them and deletes their partial files. Poll export_status until it finishes; export_cancel {job} stops one.
262 export_status reports progress, ETA, the encoder and the outcome; a done export reports its file size.262 export_status reports progress, ETA, the encoder and the outcome; a done export reports its file size.
263 Queue: export_start {queue:true} lines an export up. It keeps its own copy of the timeline as it is at that moment (later edits do not change it) and starts when every earlier export has finished, one encode at a time, with no polling needed; export_status shows it as `waiting` with the number of exports ahead. export_cancel {job} on a waiting job removes it from the queue. Without queue the export starts at once, beside any others.263 Queue: export_start {queue:true} lines an export up. It keeps its own copy of the timeline as it is at that moment (later edits do not change it) and starts when every earlier export has finished, one encode at a time, with no polling needed; export_status shows it as `waiting` with the number of exports ahead. export_cancel {job} on a waiting job removes it from the queue. Without queue the export starts at once, beside any others.
264+ export_queue {action:\"pause\"} pauses the queue: the running export finishes, and the queued ones stay waiting until export_queue {action:\"start\"}, which lifts the pause and starts the next one now if nothing is running. export_queue {action:\"status\"} (the default) says whether the queue is paused, the running export and the queued ones in order. A pause holds only queued exports; a direct export starts at once. export_status says when the queue is paused.
264 Render preview: render_preview {range?} pre-renders a stretch (default: the whole timeline) so playback over the heavy parts of a cut reads finished frames instead of compositing them. It runs in the background; project_status shows the progress and the cached ranges. An edit inside a cached range drops that render. render_preview {cancel:true} stops it.265 Render preview: render_preview {range?} pre-renders a stretch (default: the whole timeline) so playback over the heavy parts of a cut reads finished frames instead of compositing them. It runs in the background; project_status shows the progress and the cached ranges. An edit inside a cached range drops that render. render_preview {cancel:true} stops it.
265 export_status {out} for a file this session did not write reports whether it is there, its size and its time; the progress266 export_status {out} for a file this session did not write reports whether it is there, its size and its time; the progress
266 of a job from an earlier session is not known.267 of a job from an earlier session is not known.
crates/mcp/src/main.rsmodified+4 -1
@@ -144,7 +144,9 @@ fn wait_for_exports(server: &mut server::Server) {
144 .filter(|(_, j)| tools::export::job_running(j))144 .filter(|(_, j)| tools::export::job_running(j))
145 .map(|(i, j)| (i + 1, j.progress()))145 .map(|(i, j)| (i + 1, j.progress()))
146 .collect();146 .collect();
147- if running.is_empty() {147+ // A paused queue starts nothing, so once only held exports remain the wait is over.
148+ let held = server.queue_paused && server.jobs.iter().all(|j| !tools::export::job_running(j) || j.waiting());
149+ if running.is_empty() || held {
148 // Nothing else can read this outcome back, so it goes to stderr once: a failure150 // Nothing else can read this outcome back, so it goes to stderr once: a failure
149 // always (the client is gone and a missing file would otherwise be silent), a151 // always (the client is gone and a missing file would otherwise be silent), a
150 // success only under EDITH_DEBUG.152 // success only under EDITH_DEBUG.
@@ -154,6 +156,7 @@ fn wait_for_exports(server: &mut server::Server) {
154 Some(Ok(())) if debug => eprintln!("export job:{} finished: {} ({:.0?} after start)", i + 1, job.out.display(), job.started.elapsed()),156 Some(Ok(())) if debug => eprintln!("export job:{} finished: {} ({:.0?} after start)", i + 1, job.out.display(), job.started.elapsed()),
155 Some(Ok(())) => {}157 Some(Ok(())) => {}
156 Some(Err(e)) => eprintln!("export job:{} failed: {}: {e}", i + 1, job.out.display()),158 Some(Err(e)) => eprintln!("export job:{} failed: {}: {e}", i + 1, job.out.display()),
159+ None if job.waiting() => eprintln!("export job:{} was queued and never started (the queue was paused): {}", i + 1, job.out.display()),
157 None => eprintln!("export job:{} ended without a result: {}", i + 1, job.out.display()),160 None => eprintln!("export job:{} ended without a result: {}", i + 1, job.out.display()),
158 }161 }
159 }162 }
crates/mcp/src/server.rsmodified+3 -0
@@ -39,6 +39,9 @@ pub struct Server {
39 /// the history did not survive the open. Cleared wherever a new edit lands.39 /// the history did not survive the open. Cleared wherever a new edit lands.
40 pub history_lost_on_open: bool,40 pub history_lost_on_open: bool,
41 pub jobs: Vec<Job>,41 pub jobs: Vec<Job>,
42+ /// Set by `export_queue {action:"pause"}`: a queued export does not start while it is set, so
43+ /// the running one finishes and the rest wait for `export_queue {action:"start"}`.
44+ pub queue_paused: bool,
42 /// Editing copies (proxies) being made or settled, one per source (`proxies`).45 /// Editing copies (proxies) being made or settled, one per source (`proxies`).
43 pub proxy_runs: Vec<crate::tools::media::ProxyRun>,46 pub proxy_runs: Vec<crate::tools::media::ProxyRun>,
44 /// The speech model download running or finished (`speech_model`).47 /// The speech model download running or finished (`speech_model`).
crates/mcp/src/tools/export.rsmodified+117 -6
@@ -58,9 +58,99 @@ pub fn tools() -> Vec<Tool> {
58 schema: cancel_schema,58 schema: cancel_schema,
59 run: export_cancel,59 run: export_cancel,
60 },60 },
61+ Tool {
62+ name: "export_queue",
63+ description: "Pause or start the export queue (export_start {queue:true}). pause: the running export finishes, and the queued ones stay queued until start. start: lifts the pause and starts the next queued export now, if nothing is running. status: whether the queue is paused, the running export and the queued ones in order. A direct export (no queue) is not held by a pause.",
64+ schema: queue_schema,
65+ run: export_queue,
66+ },
61 ]67 ]
62 }68 }
63 69
70+fn queue_schema() -> Value {
71+ json!({
72+ "type": "object",
73+ "properties": {
74+ "action": {
75+ "type": "string",
76+ "enum": ["pause", "start", "status"],
77+ "description": "pause: queued exports stay queued after the running one ends. start: lifts the pause and starts the next queued export now if nothing is running. status (the default): whether the queue is paused, the running export and the queued ones in order."
78+ }
79+ },
80+ "additionalProperties": false
81+ })
82+}
83+
84+/// The running job's index: one with a worker that has not finished (a waiting job has none).
85+fn running_index(srv: &Server) -> Option<usize> {
86+ srv.jobs.iter().position(|j| j.handle.is_some() && job_running(j))
87+}
88+
89+/// `export_queue`: pauses the queue, lifts the pause, or reports the queue's state.
90+fn export_queue(srv: &mut Server, args: &Value) -> Reply {
91+ let action = opt_str(args, "action").unwrap_or("status");
92+ let queued_list = |srv: &Server| -> String {
93+ let waiting: Vec<String> = srv.jobs.iter().enumerate().filter(|(_, j)| j.waiting()).map(|(i, _)| format!("job:{}", i + 1)).collect();
94+ if waiting.is_empty() { "none".to_string() } else { waiting.join(", ") }
95+ };
96+ match action {
97+ "pause" => {
98+ let was = srv.queue_paused;
99+ srv.queue_paused = true;
100+ let head = if was { "queue already paused" } else { "queue paused" };
101+ let running = running_index(srv).map_or("no export is running".to_string(), |i| format!("job:{} keeps running and finishes", i + 1));
102+ Reply::ok(format!(
103+ "{head}: {running}; queued exports wait ({}) until export_queue {{action:\"start\"}}",
104+ queued_list(srv)
105+ ))
106+ .with(json!({ "action": "pause", "paused": true, "queued": queued_list(srv) }))
107+ }
108+ "start" => {
109+ let was = srv.queue_paused;
110+ srv.queue_paused = false;
111+ let next = srv.jobs.iter().position(|j| j.waiting());
112+ advance(srv);
113+ let started = next.is_some_and(|i| !srv.jobs[i].waiting());
114+ let mut text = if was { "queue started".to_string() } else { "queue was not paused".to_string() };
115+ match (started, running_index(srv), next) {
116+ (true, _, Some(i)) => text.push_str(&format!(": job:{} started now", i + 1)),
117+ (false, Some(r), Some(i)) => text.push_str(&format!(": job:{} is still running, and job:{} starts when it finishes", r + 1, i + 1)),
118+ _ => text.push_str(": nothing is waiting"),
119+ }
120+ Reply::ok(text).with(json!({ "action": "start", "paused": false, "running": running_index(srv).map(|i| i + 1), "queued": queued_list(srv) }))
121+ }
122+ "status" => {
123+ let running = running_index(srv).map(|i| {
124+ let n = i + 1;
125+ let pct = f64::from(srv.jobs[i].progress()).clamp(0.0, 1.0) * 100.0;
126+ format!("job:{n} running {pct:.0}% → {}", srv.jobs[i].out.display())
127+ });
128+ let queued: Vec<String> = srv
129+ .jobs
130+ .iter()
131+ .enumerate()
132+ .filter(|(_, j)| j.waiting())
133+ .enumerate()
134+ .map(|(k, (i, j))| format!("{}. job:{} waiting → {}", k + 1, i + 1, j.out.display()))
135+ .collect();
136+ let state = if srv.queue_paused { "paused" } else { "running" };
137+ let mut lines = vec![format!("queue {state}; {} queued", queued.len())];
138+ lines.push(format!("running: {}", running.unwrap_or_else(|| "none".to_string())));
139+ if queued.is_empty() {
140+ lines.push("queued: none".to_string());
141+ } else {
142+ lines.push("queued, in order:".to_string());
143+ lines.extend(queued);
144+ }
145+ if srv.queue_paused {
146+ lines.push("The queue is paused: queued exports do not start until export_queue {action:\"start\"}.".to_string());
147+ }
148+ Reply::ok(lines.join("\n")).with(json!({ "action": "status", "paused": srv.queue_paused, "queued": queued_list(srv), "running": running_index(srv).map(|i| i + 1) }))
149+ }
150+ other => Reply::err(format!("export_queue action `{other}` is not one of pause, start, status")),
151+ }
152+}
153+
64 fn presets_schema() -> Value {154 fn presets_schema() -> Value {
65 json!({ "type": "object", "properties": {} })155 json!({ "type": "object", "properties": {} })
66 }156 }
@@ -1666,7 +1756,9 @@ fn export_start(srv: &mut Server, args: &Value) -> Reply {
1666 // timeline and starts when they are done (`advance`). With nothing ahead it starts now.1756 // timeline and starts when they are done (`advance`). With nothing ahead it starts now.
1667 let queued = opt_bool(args, "queue").unwrap_or(false);1757 let queued = opt_bool(args, "queue").unwrap_or(false);
1668 let ahead = srv.jobs.iter().position(job_running).map(|i| i + 1);1758 let ahead = srv.jobs.iter().position(job_running).map(|i| i + 1);
1669- let (handle, pending) = if queued && ahead.is_some() {1759+ // A paused queue holds a queued export even with nothing ahead of it.
1760+ let paused = srv.queue_paused;
1761+ let (handle, pending) = if queued && (ahead.is_some() || paused) {
1670 let frames = settings.range.map_or(project.media_frames(), |(a, b)| b.min(project.media_frames()).saturating_sub(a));1762 let frames = settings.range.map_or(project.media_frames(), |(a, b)| b.min(project.media_frames()).saturating_sub(a));
1671 let length_secs = f64::from(frames) / meta.frame_rate;1763 let length_secs = f64::from(frames) / meta.frame_rate;
1672 (None, Some(Box::new(Pending { project, meta, settings: settings.clone(), sample_rate, length_secs })))1764 (None, Some(Box::new(Pending { project, meta, settings: settings.clone(), sample_rate, length_secs })))
@@ -1705,7 +1797,9 @@ fn export_start(srv: &mut Server, args: &Value) -> Reply {
1705 let preset_note = preset.map_or_else(String::new, |p| format!("; preset {}", p.id));1797 let preset_note = preset.map_or_else(String::new, |p| format!("; preset {}", p.id));
1706 let verb = if waiting { "queued" } else { "started" };1798 let verb = if waiting { "queued" } else { "started" };
1707 let mut text = format!("job:{job} {verb} → {} ({when}); {words}{captions}{tone_note}{size_note}{fit_note}{preset_note}{loudness_note}", out.display());1799 let mut text = format!("job:{job} {verb} → {} ({when}); {words}{captions}{tone_note}{size_note}{fit_note}{preset_note}{loudness_note}", out.display());
1708- if waiting {1800+ if waiting && paused {
1801+ text.push_str("\nWaiting: the export queue is paused, so this one starts only when export_queue {action:\"start\"} is sent, from the timeline as it is now (later edits do not change it). export_status shows the queue; export_cancel with its job removes it.");
1802+ } else if waiting {
1709 text.push_str(&format!(1803 text.push_str(&format!(
1710 "\nWaiting: it starts when job:{} and every export queued before it have finished, from the timeline as it is now (later edits do not change it). export_status shows it as waiting; export_cancel with its job removes it.",1804 "\nWaiting: it starts when job:{} and every export queued before it have finished, from the timeline as it is now (later edits do not change it). export_status shows it as waiting; export_cancel with its job removes it.",
1711 ahead.unwrap_or(1)1805 ahead.unwrap_or(1)
@@ -1838,12 +1932,13 @@ pub fn job_running(job: &Job) -> bool {
1838 1932
1839 /// Moves the queue on: a waiting job whose cancel arrived is settled by `Job::cancel`; when no1933 /// Moves the queue on: a waiting job whose cancel arrived is settled by `Job::cancel`; when no
1840 /// worker is running, the first waiting job starts from its own copy of the timeline. One encode1934 /// worker is running, the first waiting job starts from its own copy of the timeline. One encode
1841-/// at a time. Called on every server tick, so a queue drains with no client polling.1935+/// at a time. A paused queue (`export_queue {action:"pause"}`) starts nothing new. Called on every
1936+/// server tick, so a queue drains with no client polling.
1842 pub fn advance(srv: &mut Server) {1937 pub fn advance(srv: &mut Server) {
1843 for job in srv.jobs.iter_mut() {1938 for job in srv.jobs.iter_mut() {
1844 settle(job);1939 settle(job);
1845 }1940 }
1846- if srv.jobs.iter().any(|j| j.handle.is_some() && job_running(j)) {1941+ if srv.queue_paused || srv.jobs.iter().any(|j| j.handle.is_some() && job_running(j)) {
1847 return;1942 return;
1848 }1943 }
1849 if let Some(job) = srv.jobs.iter_mut().find(|j| j.outcome.is_none() && j.waiting())1944 if let Some(job) = srv.jobs.iter_mut().find(|j| j.outcome.is_none() && j.waiting())
@@ -1874,7 +1969,7 @@ fn export_status(srv: &mut Server, args: &Value) -> Reply {
1874 None => Reply::ok(unknown_out_text(&anchored)).with(json!({"jobs": [], "finished": 0})),1969 None => Reply::ok(unknown_out_text(&anchored)).with(json!({"jobs": [], "finished": 0})),
1875 };1970 };
1876 }1971 }
1877- if srv.jobs.is_empty() && args.get("job").is_none() {1972+ if srv.jobs.is_empty() && args.get("job").is_none() && !srv.queue_paused {
1878 return Reply::ok(1973 return Reply::ok(
1879 "no exports in this session — export_start makes one. An export from an earlier session is not tracked here: pass out (its file path) to see whether its file is there",1974 "no exports in this session — export_start makes one. An export from an earlier session is not tracked here: pass out (its file path) to see whether its file is there",
1880 )1975 )
@@ -1922,6 +2017,9 @@ fn export_status(srv: &mut Server, args: &Value) -> Reply {
1922 if args.get("job").is_none() {2017 if args.get("job").is_none() {
1923 let unfinished = srv.jobs.len() - finished_total;2018 let unfinished = srv.jobs.len() - finished_total;
1924 lines.push(format!("exports: {unfinished} unfinished, {finished_total} finished"));2019 lines.push(format!("exports: {unfinished} unfinished, {finished_total} finished"));
2020+ if srv.queue_paused {
2021+ lines.push("queue paused: queued exports wait until export_queue {action:\"start\"}".to_string());
2022+ }
1925 }2023 }
1926 for i in ids {2024 for i in ids {
1927 let job = &srv.jobs[i];2025 let job = &srv.jobs[i];
@@ -1977,6 +2075,7 @@ fn export_status(srv: &mut Server, args: &Value) -> Reply {
1977 let eta_text = eta.map_or_else(|| "unknown".to_string(), clock_secs);2075 let eta_text = eta.map_or_else(|| "unknown".to_string(), clock_secs);
1978 let ahead = srv.jobs[..i].iter().filter(|j| j.outcome.is_none()).count();2076 let ahead = srv.jobs[..i].iter().filter(|j| j.outcome.is_none()).count();
1979 let line = match job.stage() {2077 let line = match job.stage() {
2078+ _ if job.waiting() && srv.queue_paused => format!("job:{n} waiting (queue paused) · {ahead} export{} ahead → {out}", if ahead == 1 { "" } else { "s" }),
1980 _ if job.waiting() => format!("job:{n} waiting · {ahead} export{} ahead → {out}", if ahead == 1 { "" } else { "s" }),2079 _ if job.waiting() => format!("job:{n} waiting · {ahead} export{} ahead → {out}", if ahead == 1 { "" } else { "s" }),
1981 // A stage before the encode has its own percent; the encode's ETA2080 // A stage before the encode has its own percent; the encode's ETA
1982 // means nothing yet.2081 // means nothing yet.
@@ -2036,7 +2135,7 @@ fn export_status(srv: &mut Server, args: &Value) -> Reply {
2036 if lines.is_empty() {2135 if lines.is_empty() {
2037 lines.push("no exports to show".to_string());2136 lines.push("no exports to show".to_string());
2038 }2137 }
2039- Reply::ok(lines.join("\n")).with(json!({ "jobs": rows, "finished": finished_total }))2138+ Reply::ok(lines.join("\n")).with(json!({ "jobs": rows, "finished": finished_total, "queue_paused": srv.queue_paused }))
2040 }2139 }
2041 2140
2042 /// The true-peak ceiling the advice names: -2 dBTP for a lossy file, whose encoder can add about a2141 /// The true-peak ceiling the advice names: -2 dBTP for a lossy file, whose encoder can add about a
@@ -3155,6 +3254,18 @@ mod tests {
3155 }3254 }
3156 }3255 }
3157 3256
3257+ /// Pause sets the flag and status says so; start lifts it, with nothing waiting to start.
3258+ #[test]
3259+ fn queue_pause_and_start_set_the_flag_and_say_so() {
3260+ let mut srv = Server::new();
3261+ let paused = export_queue(&mut srv, &json!({"action": "pause"}));
3262+ assert!(!paused.is_error && srv.queue_paused, "{}", paused.text);
3263+ let status = export_queue(&mut srv, &json!({"action": "status"}));
3264+ assert!(status.text.contains("queue paused") && status.text.contains("queued: none"), "{}", status.text);
3265+ let started = export_queue(&mut srv, &json!({"action": "start"}));
3266+ assert!(!srv.queue_paused && started.text.contains("nothing is waiting"), "{}", started.text);
3267+ }
3268+
3158 /// A waiting job cancelled by number never starts and writes nothing; the queue moves past it.3269 /// A waiting job cancelled by number never starts and writes nothing; the queue moves past it.
3159 #[test]3270 #[test]
3160 fn a_waiting_job_can_be_cancelled_and_never_starts() {3271 fn a_waiting_job_can_be_cancelled_and_never_starts() {