rushes 0.6.3 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/AGENTS.md +6 -2
- package/README.md +8 -1
- package/dist/cli/main.js +10 -3
- package/dist/core/batches.js +3 -1
- package/dist/core/exportNotes.js +3 -0
- package/dist/core/logEvents.js +12 -3
- package/dist/core/logText.js +1 -1
- package/dist/core/project.js +29 -1
- package/dist/core/schema.js +19 -0
- package/dist/core/store.js +1 -1
- package/dist/core/tabs.js +3 -1
- package/dist/mcp/tools.js +7 -7
- package/dist/server/app.js +67 -22
- package/dist/server/found.js +17 -9
- package/package.json +1 -1
- package/skills/rushes/SKILL.md +4 -0
- package/web-dist/assets/index-B4EIQ7WV.js +7 -0
- package/web-dist/assets/index-BH66xs4n.css +1 -0
- package/web-dist/index.html +2 -2
- package/web-dist/assets/index-Bc-DIF61.js +0 -7
- package/web-dist/assets/index-V7YEFWgg.css +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rushes",
|
|
3
3
|
"description": "A local review desk for video made with AI agents: timecoded notes, script edits and audio picks your agent reads and acts on.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.7.1",
|
|
5
5
|
"author": { "name": "Red Morley Hewitt" },
|
|
6
6
|
"homepage": "https://github.com/iamredmh/rushes",
|
|
7
7
|
"repository": "https://github.com/iamredmh/rushes",
|
package/AGENTS.md
CHANGED
|
@@ -103,6 +103,10 @@ The user drags to mark a region on the picture, clicks for a point, or adds a no
|
|
|
103
103
|
|
|
104
104
|
To answer feedback, change the marked pictures and register the result as a new version of the same visual: call `rushes_add_visual` with `visual` (its id or name) and `pages` listing only the pages that changed or are new, each with its `n`; every other page, and any ratio of a listed page you leave out, carries over from the version before. Pages can be added at the end and never removed. Then `rushes_reply` to each note you fixed with `status: "done"`, a one-line `reply` and `fixVersion` set to that version, as on every other tab. A note you did not fix stays `todo`, with the reason in `reply`. The user can open a note again with the tick. Rushes keeps each note on the version it was made on, and shows it as "from v1" beside the newer one.
|
|
105
105
|
|
|
106
|
+
## Shelved films
|
|
107
|
+
|
|
108
|
+
The user can shelve a film they have set aside (the **Film actions** menu in the dashboard). `rushes_status` returns `films`, each with `shelved`: the time it was shelved, or null. A shelved film is the user's decision: leave it alone, make no new cuts of it and fix none of its notes unless the user asks. Its open notes are not counted in the tabs or sent in batches, and `rushes_list_notes` leaves them out. A new cut of a shelved film brings it back (the reply has `restored: true`), so make one only when the user wants that film worked on again. You never shelve or restore a film: that is the user's to do.
|
|
109
|
+
|
|
106
110
|
## The loop
|
|
107
111
|
|
|
108
112
|
1. **Register what you made.**
|
|
@@ -117,7 +121,7 @@ To answer feedback, change the marked pictures and register the result as a new
|
|
|
117
121
|
4. **Fix each note.** A note has `stage`, `scope` (`point`, `range` or `whole` — Voiceover only ever uses `point` or `whole`; it has no Range scope), `t`, `tOut`, `on` (the lane, variant, take, cue or section it's about), `text`, and optionally `box` (normalised 0 to 1), `grab` (a PNG path in `screenshots/`; older notes may point to `.rushes/grabs/`), `shot` (the shot it falls in, `{n, name}`, worked out by the server from the version's shots — not yours to set) and, on Picture, `format` (`null` when the note is for every format, or a format id such as `"9x16"` when it's for that shape only). When a note's `format` is not null, fix only that format and leave the others alone; an all-format note is for every shape, so fix each and say in `reply` which formats you fixed. `rushes_list_notes` takes `format` (an id such as `9x16`, or its label `9:16`: that format's Picture notes plus the all-format ones) and `onlyThisFormat: true` (only that format's). On an audio stage, `on` is `"<laneId>/<variantId>"` for a music bed, SFX pass or voice read (the lane and variant ids `rushes_add_variant` returns) — on Voiceover the lane id is the round's slugged name, so `on` names the round and the read together — or `"<laneId>/<variantId>:<cueId>"` for an SFX cue. On Mix it's `null` for the whole mix, `"vo"` for the VO lane (the newest round with a pick), or `"<laneId>/<variantId>"` for the music or SFX lane. Older notes may carry a bare variant id, `"vo"` on Voiceover itself, a section id, `"<sectionId>:<takeId>"` for a take, `"<variantId>:<cueId>"` or a bare cue id; Rushes still lists these with a sensible label, but none of them name a read any more. On Music, Sound effects and Mix, a note can also carry `marks` — short feedback like `Fall` (bring the level down over the range) or `Quieter 3 dB` (3 dB lower over the range). `rushes_list_notes`, `rushes_get_batch` and exported notes all show them. Marks are the user's, like a note's text and times — you read and act on them, you don't set them. Voiceover notes carry no marks: a note there is **Whole** (`Speaker`, `Pacing`, `Tone` or `Overall` — about the read as a whole) or **Point** (`Fix this` or `Keep this`, marked at the playhead).
|
|
118
122
|
5. **Register the new cut** with `rushes_add_version`, with a short `label` and the detail in `note`. If the video is locked, the reply carries `warning: "Picture is locked at vN"`; the version is still added.
|
|
119
123
|
6. **Reply to every note** in one `rushes_reply` call. For each, set `status: "done"`, a one-line `reply`, `fixT` (when the fix is visible in the new cut, in seconds) and `fixVersion`. If you didn't fix a note, leave it `todo` and say why in `reply`.
|
|
120
|
-
7. **Audio batches.** On Voiceover, Music, Sound effects or Mix, call `rushes_get_picks` first, so you know which read or variant is in use before you fix anything. On Mix, it also returns `levels: { voice?, music?, sfx? }` in dB — where the user wants each lane to sit. Don't try to change these; they're set from the dashboard's sliders and only tell you the balance the user has already chosen. Then fix each note:
|
|
124
|
+
7. **Audio batches.** On Voiceover, Music, Sound effects or Mix, call `rushes_get_picks` first (pass the note's film as `video`: picks and levels are per film), so you know which read or variant is in use before you fix anything. On Mix, it also returns `levels: { voice?, music?, sfx? }` in dB — where the user wants each lane to sit. Don't try to change these; they're set from the dashboard's sliders and only tell you the balance the user has already chosen. Then fix each note:
|
|
121
125
|
- **Voiceover:** register a new whole read with `rushes_add_variant` (`stage: "voice"`) — a new round for a new direction (another voice, a different tone), or the current round for a small fix to a marked word. Say in `description` what changed.
|
|
122
126
|
- **Music or Sound effects:** make the new bed or pass the text and marks ask for, and register it as in step 1.
|
|
123
127
|
|
|
@@ -153,7 +157,7 @@ The MCP server has twenty-three tools: `rushes_open`, `rushes_status`, `rushes_a
|
|
|
153
157
|
## Rules
|
|
154
158
|
|
|
155
159
|
- Never edit `.rushes/*.json` by hand while the server is running. Use the tools, or the CLI (`rushes add`, `rushes notes`, `rushes reply`).
|
|
156
|
-
- Picks — which variant is in use per lane — are set from the dashboard only (**Use** / **Unpick**). No tool or CLI command sets one; read them with `rushes_get_picks`. Section take picks remain in the file format for compatibility only; nothing sets them any more.
|
|
160
|
+
- Picks — which variant is in use per lane, for each film on its own — are set from the dashboard only (**Use** / **Unpick**). No tool or CLI command sets one; read them with `rushes_get_picks`. Section take picks remain in the file format for compatibility only; nothing sets them any more.
|
|
157
161
|
- A project whose voiceover exists only as takes from before rounds keeps Voiceover locked until a voice read exists, but open notes on those takes still count towards Send to agent and can be answered with `rushes_reply`.
|
|
158
162
|
- You own a note's `reply`, `fixT` and `fixVersion`. The user owns its text, times and box. Either of you can set `status`.
|
|
159
163
|
- After the first cut, send the storyboard's shots with `rushes_set_shots`; when a new cut moves them, send new timings.
|
package/README.md
CHANGED
|
@@ -111,6 +111,12 @@ The **Visuals** tab (key `7`) is for the stills, standalone images and carousels
|
|
|
111
111
|
|
|
112
112
|
**Drag** on the picture to mark a region, click to drop a point, or press **Whole image** for a note about all of it. The composer always says where the note will go ("Adding to: Launch carousel · page 3 · 4:5 · v2"), and a draft stays with the visual you began it on. Notes belong to a page, a ratio and a version, never to where you have scrolled, so every mark is still there when you come back. The notes column lists the whole tab, grouped by visual and page, with the visual you are looking at highlighted and the rest faded; click a note to jump to it. When your agent registers a new version, your old notes stay with the version they were made on ("from v1"), marked until you tick them done.
|
|
113
113
|
|
|
114
|
+
### Shelve a film
|
|
115
|
+
|
|
116
|
+
A film that went nowhere can be set aside without losing it. Open the **⋯** button beside the Change Log ("Film actions · Hero") and choose **Shelve film**, or press **Shift+S**. The film leaves the bar, a toast offers **Undo**, and its open notes stop counting: they leave the Send to agent count, the tab to-do counts, batches and Export notes, and they come back when you restore the film. Nothing is deleted: its cuts, notes, picks and files stay as they were.
|
|
117
|
+
|
|
118
|
+
Pills only switch films. When the films still in play do not fit the bar, the rest fold into a **+N** list (the film you are on is always shown). **Shelved (N)** at the end of the bar lists the shelved films: choose one to look at it, view-only, under a "Shelved" banner, and **Restore** it from the list or the banner. A new cut from your agent also brings a shelved film back. Your agent can see which films are shelved, but never shelves or restores one.
|
|
119
|
+
|
|
114
120
|
### Sound effects: layers by sound
|
|
115
121
|
|
|
116
122
|
<img src="docs/assets/screens/sound-effects.jpg" alt="The Sound effects tab with one pass open into its layers. There is one row per sound (tick, thud, blip, chime, whoosh, counter, thump, snap), each with a count and a mark wherever it plays." width="880">
|
|
@@ -264,7 +270,8 @@ In the Voiceover, Music, Sound effects and Mix tabs:
|
|
|
264
270
|
Anywhere:
|
|
265
271
|
|
|
266
272
|
- **1–8** switch tab (1: Planning, which opens the page you used last; 7: Visuals; 8: Assets)
|
|
267
|
-
- **[ / ]** previous/next film
|
|
273
|
+
- **[ / ]** previous/next film in play
|
|
274
|
+
- **Shift+S** shelve the current film, or restore it if it is shelved
|
|
268
275
|
- **Alt+←/→** previous/next format (Picture)
|
|
269
276
|
- **?** shortcuts
|
|
270
277
|
- **Esc** close
|
package/dist/cli/main.js
CHANGED
|
@@ -47,7 +47,7 @@ Usage
|
|
|
47
47
|
register a doc, image, caption, export, delivery or edit file
|
|
48
48
|
rushes lock <video> <version> lock the picture at a cut
|
|
49
49
|
rushes unlock <video> unlock the picture
|
|
50
|
-
rushes notes [--stage S] [--status todo|done] [--batch ID] [--json]
|
|
50
|
+
rushes notes [--stage S] [--status todo|done] [--batch ID] [--include-shelved] [--json]
|
|
51
51
|
rushes reply <note-id> <text> [--done] [--fix-t SECONDS] [--fix-version V]
|
|
52
52
|
rushes assets [--kind K] [--json] cuts, takes, variants, screenshots and library files
|
|
53
53
|
rushes scan [--film NAME] [--json] look through the folder for the files that go with the cut; also brings in the current set
|
|
@@ -85,6 +85,7 @@ const OPTIONS = {
|
|
|
85
85
|
area: { type: "string" },
|
|
86
86
|
md: { type: "boolean" },
|
|
87
87
|
json: { type: "boolean" },
|
|
88
|
+
"include-shelved": { type: "boolean" },
|
|
88
89
|
done: { type: "boolean" },
|
|
89
90
|
"fix-t": { type: "string" },
|
|
90
91
|
"fix-version": { type: "string" },
|
|
@@ -339,7 +340,7 @@ export async function main(argv, io) {
|
|
|
339
340
|
return 0;
|
|
340
341
|
case "status": {
|
|
341
342
|
const root = rest[0] ? resolve(io.cwd, rest[0]) : dir;
|
|
342
|
-
const { tabs, brief, storyboard, build } = await (await ensureServer(root, io.ensure)).get("/api/tabs");
|
|
343
|
+
const { tabs, brief, storyboard, build, films } = await (await ensureServer(root, io.ensure)).get("/api/tabs");
|
|
343
344
|
// The second column starts in the same place on every line: as wide as the longest label shown.
|
|
344
345
|
const w = storyboard?.exists ? "storyboard".length : 8;
|
|
345
346
|
for (const t of tabs) {
|
|
@@ -353,6 +354,10 @@ export async function main(argv, io) {
|
|
|
353
354
|
io.out(`${"storyboard".padEnd(w)} ${storyboard.approved} of ${storyboard.shots} approved${storyboard.changed ? `, ${storyboard.changed} changed` : ""}`);
|
|
354
355
|
if (build?.started)
|
|
355
356
|
io.out(`${"build".padEnd(w)} ${build.ready ? "ready" : `waiting on ${build.waitingOn.join(", ")}`}`);
|
|
357
|
+
// §26: the films the user has set aside, so an agent leaves them alone. Nothing is printed when none are.
|
|
358
|
+
const shelved = (films ?? []).filter((f) => f.shelved).map((f) => f.name);
|
|
359
|
+
if (shelved.length)
|
|
360
|
+
io.out(`${"shelved".padEnd(w)} ${shelved.join(", ")}`);
|
|
356
361
|
return 0;
|
|
357
362
|
}
|
|
358
363
|
case "doctor": {
|
|
@@ -380,7 +385,7 @@ export async function main(argv, io) {
|
|
|
380
385
|
return 2;
|
|
381
386
|
}
|
|
382
387
|
const r = await (await client()).post("/api/versions", { video: o.video, file: resolve(io.cwd, a), note: o.note, label: o.label });
|
|
383
|
-
io.out(`Added ${r.video.name} ${r.version.id}`);
|
|
388
|
+
io.out(`Added ${r.video.name} ${r.version.id}${r.restored ? " (it was shelved: restored)" : ""}`);
|
|
384
389
|
// A Rushes started by an older version ignores `label` and its reply has none.
|
|
385
390
|
if (o.label?.trim() && r.version.label === undefined)
|
|
386
391
|
io.err("An older Rushes is running and dropped the label: the cut was added without it. Run `rushes stop`, then open again.");
|
|
@@ -465,6 +470,8 @@ export async function main(argv, io) {
|
|
|
465
470
|
for (const k of ["stage", "status", "batch"])
|
|
466
471
|
if (o[k])
|
|
467
472
|
q.set(k, o[k]);
|
|
473
|
+
if (o["include-shelved"])
|
|
474
|
+
q.set("includeShelved", "true");
|
|
468
475
|
const c = await client();
|
|
469
476
|
const { notes } = await c.get(`/api/notes${q.size ? `?${q}` : ""}`);
|
|
470
477
|
if (o.json)
|
package/dist/core/batches.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { chipOrder, versionFormats } from "./formats.js";
|
|
2
2
|
import { EmptyBatchError } from "./errors.js";
|
|
3
|
+
import { noteInPlay } from "./project.js";
|
|
3
4
|
import { isChanged } from "./script.js";
|
|
4
5
|
const STAGE_NAMES = {
|
|
5
6
|
script: "script",
|
|
@@ -15,7 +16,8 @@ const STAGE_NAMES = {
|
|
|
15
16
|
* batch yet, and (on the script tab) changed or flagged sections.
|
|
16
17
|
*/
|
|
17
18
|
export function createBatch(ctx, stage, now = new Date()) {
|
|
18
|
-
|
|
19
|
+
// §26: a shelved film is never asked about; its open notes stay unsent.
|
|
20
|
+
const notes = ctx.notes.notes.filter((n) => n.stage === stage && n.status === "todo" && n.batch === null && noteInPlay(n, ctx.project));
|
|
19
21
|
const sections = stage === "script" ? ctx.script.sections.filter((s) => isChanged(s) || s.status === "flagged") : [];
|
|
20
22
|
if (notes.length === 0 && sections.length === 0)
|
|
21
23
|
throw new EmptyBatchError(stage);
|
package/dist/core/exportNotes.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { formatTag } from "./formats.js";
|
|
2
2
|
import { slugify } from "./ids.js";
|
|
3
3
|
import { onLabel } from "./notes.js";
|
|
4
|
+
import { noteInPlay } from "./project.js";
|
|
4
5
|
import { markLabel } from "./schema.js";
|
|
5
6
|
import { labelOfId } from "./formats.js";
|
|
6
7
|
import { pinWords, regionWords } from "./visuals.js";
|
|
@@ -93,6 +94,8 @@ function byTimecode(a, b) {
|
|
|
93
94
|
*/
|
|
94
95
|
export function notesMarkdown(project, notes, now, script = { sections: [] }, picks, visuals) {
|
|
95
96
|
const ctx = { project, script, picks };
|
|
97
|
+
// §26: a shelved film has no section; its notes are kept in the project and come back when it is restored.
|
|
98
|
+
notes = notes.filter((n) => noteInPlay(n, project));
|
|
96
99
|
const lines = [`# ${project.name} — notes`, `Exported ${localDateTime(now)}`];
|
|
97
100
|
for (const stage of STAGE_ORDER) {
|
|
98
101
|
const stageNotes = notes.filter((n) => n.stage === stage);
|
package/dist/core/logEvents.js
CHANGED
|
@@ -126,15 +126,19 @@ export function takeEvent(section, take, number) {
|
|
|
126
126
|
export function scriptEvent(sections) {
|
|
127
127
|
return { area: "script", kind: "script", merge: "replace", text: `Script set: ${plural(sections, "section", "sections")}` };
|
|
128
128
|
}
|
|
129
|
-
/** `Picks: voice “Vo Jules, full read”, music “Night drive, held back”`, the whole set after the change
|
|
130
|
-
export function picksEvent(project, lanes) {
|
|
129
|
+
/** `Picks: voice “Vo Jules, full read”, music “Night drive, held back”`, the whole set after the change; for one film, `Picks for “Key”: …`. */
|
|
130
|
+
export function picksEvent(project, lanes, video) {
|
|
131
131
|
const parts = [];
|
|
132
132
|
for (const lane of project.lanes) {
|
|
133
133
|
const v = lane.variants.find((x) => x.id === lanes[lane.id]);
|
|
134
134
|
if (v)
|
|
135
135
|
parts.push(`${PICK_WORDS[lane.stage]} ${quoted(v.name, lane.stage === "voice" ? "a read" : "a variant")}`);
|
|
136
136
|
}
|
|
137
|
-
|
|
137
|
+
const film = video ? named(video.name, PLACE_MAX) : "";
|
|
138
|
+
const head = film ? `Picks for ${quoted(film, "")}` : "Picks";
|
|
139
|
+
// Per film, so one film's picks never replace another's line in the log.
|
|
140
|
+
const scope = video ? { subject: video.id, video: video.id, version: null } : {};
|
|
141
|
+
return { area: "mix", kind: "picks", merge: "replace", windowMs: PICKS_MERGE_MS, ...scope, text: parts.length ? `${head}: ${parts.join(", ")}` : `${video ? `${head} cleared` : "Picks cleared"}` };
|
|
138
142
|
}
|
|
139
143
|
/** "Picture locked at v6", "Picture unlocked". */
|
|
140
144
|
export function lockEvent(films, video) {
|
|
@@ -142,6 +146,11 @@ export function lockEvent(films, video) {
|
|
|
142
146
|
const text = video.lockedVersion ? `Picture locked at ${cutName(films, video, video.lockedVersion)}` : `Picture unlocked${films > 1 && film ? ` for ${film}` : ""}`;
|
|
143
147
|
return { area: "picture", kind: "lock", merge: "replace", subject: video.id, text, video: video.id, version: video.lockedVersion };
|
|
144
148
|
}
|
|
149
|
+
/** §26: "Film “Key” shelved", "Film “Key” restored". One line per change; the last state wins, as a lock does. */
|
|
150
|
+
export function filmEvent(video, shelved) {
|
|
151
|
+
const text = ["Film", quoted(video.name, ""), shelved ? "shelved" : "restored"].filter(Boolean).join(" ");
|
|
152
|
+
return { area: "picture", kind: "film", merge: "replace", subject: video.id, text, video: video.id, version: null };
|
|
153
|
+
}
|
|
145
154
|
/** "3 notes sent from Picture"; on Script, "1 note and 2 script edits sent from Script". */
|
|
146
155
|
export function notesSentEvent(batch) {
|
|
147
156
|
const tab = TAB_NAMES[batch.stage];
|
package/dist/core/logText.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// (test/core/logText.test.ts checks it).
|
|
4
4
|
import { oneLine, oneLineOf } from "./labels.js";
|
|
5
5
|
export const LOG_AREAS = ["script", "picture", "voice", "music", "sfx", "mix", "visuals", "notes", "assets", "project"];
|
|
6
|
-
export const LOG_KINDS = ["cut", "variant", "take", "script", "picks", "notes-sent", "replies", "lock", "files", "entry", "format", "visual"];
|
|
6
|
+
export const LOG_KINDS = ["cut", "variant", "take", "script", "picks", "notes-sent", "replies", "lock", "files", "entry", "format", "visual", "film"];
|
|
7
7
|
export const LOG_BY = ["user", "agent", "rushes"];
|
|
8
8
|
/** The most lines log.json keeps; past it the oldest go (§22.3). */
|
|
9
9
|
export const LOG_MAX = 5000;
|
package/dist/core/project.js
CHANGED
|
@@ -33,9 +33,37 @@ export function ensureProjectIdOnce(store) {
|
|
|
33
33
|
}
|
|
34
34
|
return p;
|
|
35
35
|
}
|
|
36
|
+
/** §26: a film is in play unless it has been shelved. */
|
|
37
|
+
export const inPlay = (video) => !video.shelved;
|
|
38
|
+
/** §26: a note is in play unless it is on a shelved film. A note on no film, or on a film that is gone, always is. */
|
|
39
|
+
export function noteInPlay(note, project) {
|
|
40
|
+
if (!note.video)
|
|
41
|
+
return true;
|
|
42
|
+
const film = project.videos.find((v) => v.id === note.video);
|
|
43
|
+
return !film || inPlay(film);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* §26: shelves a film (keeping the time it was first shelved), or restores it by removing the mark. Nothing else about the
|
|
47
|
+
* film changes: its cuts, notes, picks, takes and lock stay as they were. The same call twice is the same as once.
|
|
48
|
+
*/
|
|
49
|
+
export function shelveFilm(p, videoRef, shelved, now = new Date()) {
|
|
50
|
+
const video = resolveVideo(p, videoRef);
|
|
51
|
+
if (shelved) {
|
|
52
|
+
if (!video.shelved)
|
|
53
|
+
video.shelved = now.toISOString();
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
delete video.shelved;
|
|
57
|
+
}
|
|
58
|
+
return video;
|
|
59
|
+
}
|
|
60
|
+
/** `restored` is true when the cut brought a shelved film back (§26): new work means the film is in play again. */
|
|
36
61
|
export function addVersion(p, input, now = new Date()) {
|
|
37
62
|
const vid = slugify(input.video);
|
|
38
63
|
let video = p.videos.find((v) => v.id === input.video || v.id === vid);
|
|
64
|
+
const restored = !!video?.shelved;
|
|
65
|
+
if (video)
|
|
66
|
+
delete video.shelved;
|
|
39
67
|
if (!video) {
|
|
40
68
|
video = { id: uniqueId(vid, p.videos.map((v) => v.id)), name: input.video, versions: [], lockedVersion: null };
|
|
41
69
|
p.videos.push(video);
|
|
@@ -62,7 +90,7 @@ export function addVersion(p, input, now = new Date()) {
|
|
|
62
90
|
formats: [],
|
|
63
91
|
};
|
|
64
92
|
video.versions.push(version);
|
|
65
|
-
return { video, version };
|
|
93
|
+
return { video, version, restored };
|
|
66
94
|
}
|
|
67
95
|
export function latestVersion(video) {
|
|
68
96
|
return video.versions[video.versions.length - 1];
|
package/dist/core/schema.js
CHANGED
|
@@ -84,6 +84,8 @@ export const VideoSchema = fileObject({
|
|
|
84
84
|
name: z.string().min(1),
|
|
85
85
|
versions: z.array(VersionSchema).default([]),
|
|
86
86
|
lockedVersion: z.string().nullable().default(null),
|
|
87
|
+
// §26: the time a film was shelved. Absent (or null) means it is in play; restoring removes the key.
|
|
88
|
+
shelved: z.string().max(40).nullable().optional(),
|
|
87
89
|
});
|
|
88
90
|
export const CueSchema = fileObject({
|
|
89
91
|
id,
|
|
@@ -266,14 +268,31 @@ export const LEVEL_MIN = -24;
|
|
|
266
268
|
export const LEVEL_MAX = 6;
|
|
267
269
|
export const LEVEL_STEP = 0.5;
|
|
268
270
|
export const LevelsSchema = fileObject({ voice: z.number(), music: z.number(), sfx: z.number() }).partial().default({});
|
|
271
|
+
// What one film hears: its own pick per lane and its own Mix levels. Music, sound effects, the
|
|
272
|
+
// voiceover read and the levels belong to a film, so a second film never inherits the first's.
|
|
273
|
+
export const VideoPicksSchema = fileObject({
|
|
274
|
+
lanes: z.record(z.string(), z.string()).default({}),
|
|
275
|
+
levels: LevelsSchema,
|
|
276
|
+
});
|
|
269
277
|
export const PicksSchema = fileObject({
|
|
270
278
|
schema: z.literal(1),
|
|
271
279
|
rev: z.number().int().nonnegative(),
|
|
280
|
+
// The project-wide picks of a project from before picks were per film. Nothing reads them for a
|
|
281
|
+
// film any more; a write that names no film (an old client, a test) still lands here.
|
|
272
282
|
lanes: z.record(z.string(), z.string()).default({}),
|
|
273
283
|
sections: z.record(z.string(), z.string()).default({}),
|
|
274
284
|
// §19.6: each Mix lane's level in dB, defaulting to 0 (absent). Keyed the same as LaneStage.
|
|
275
285
|
levels: LevelsSchema,
|
|
286
|
+
// Each film's own picks and levels, keyed by video id. A film with no entry has picked nothing.
|
|
287
|
+
videos: z.record(z.string(), VideoPicksSchema).default({}),
|
|
276
288
|
});
|
|
289
|
+
/** The picks one film plays: its own entry, or nothing picked. With no film named, the project-wide set. */
|
|
290
|
+
export function picksForVideo(picks, videoId) {
|
|
291
|
+
if (!videoId)
|
|
292
|
+
return picks;
|
|
293
|
+
const own = picks.videos[videoId];
|
|
294
|
+
return { ...picks, lanes: { ...(own?.lanes ?? {}) }, levels: { ...(own?.levels ?? {}) }, sections: {}, videos: {} };
|
|
295
|
+
}
|
|
277
296
|
export const BatchSchema = fileObject({
|
|
278
297
|
id,
|
|
279
298
|
stage: StageSchema,
|
package/dist/core/store.js
CHANGED
|
@@ -14,7 +14,7 @@ function defaults(key, name) {
|
|
|
14
14
|
case "notes":
|
|
15
15
|
return { schema: 1, rev: 0, notes: [] };
|
|
16
16
|
case "picks":
|
|
17
|
-
return { schema: 1, rev: 0, lanes: {}, sections: {}, levels: {} };
|
|
17
|
+
return { schema: 1, rev: 0, lanes: {}, sections: {}, levels: {}, videos: {} };
|
|
18
18
|
case "batches":
|
|
19
19
|
return { schema: 1, rev: 0, batches: [] };
|
|
20
20
|
case "found":
|
package/dist/core/tabs.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { STAGES } from "./schema.js";
|
|
2
|
+
import { noteInPlay } from "./project.js";
|
|
2
3
|
import { isChanged } from "./script.js";
|
|
3
4
|
function laneHasVariants(p, stage) {
|
|
4
5
|
return p.lanes.some((l) => l.stage === stage && l.variants.length > 0);
|
|
@@ -19,7 +20,8 @@ export function tabStates(p, s, n, v = { visuals: [] }) {
|
|
|
19
20
|
visuals: v.visuals.length > 0,
|
|
20
21
|
};
|
|
21
22
|
return STAGES.map((stage) => {
|
|
22
|
-
|
|
23
|
+
// §26: a shelved film's open notes are kept but do not count.
|
|
24
|
+
const notes = n.notes.filter((x) => x.stage === stage && x.status === "todo" && noteInPlay(x, p)).length;
|
|
23
25
|
const rows = stage === "script" ? s.sections.filter((x) => isChanged(x) || x.status === "flagged").length : 0;
|
|
24
26
|
return { stage, unlocked: unlocked[stage], todo: notes + rows };
|
|
25
27
|
});
|
package/dist/mcp/tools.js
CHANGED
|
@@ -114,7 +114,7 @@ export function createMcpServer(ctx) {
|
|
|
114
114
|
}));
|
|
115
115
|
server.registerTool("rushes_bring_in", {
|
|
116
116
|
title: "Bring files in",
|
|
117
|
-
description: "Registers files from inside the project folder: voice reads, music and sfx as unpicked variants, video as cuts, md, txt and pdf as docs. Nothing is picked. Returns what was added and, for each file that couldn't come in, why (a path outside the project folder is refused). Up to 60 files, 12 of a kind.",
|
|
117
|
+
description: "Registers files from inside the project folder: voice reads, music and sfx as unpicked variants, video as cuts, md, txt and pdf as docs. Nothing is picked. Returns what was added and, for each file that couldn't come in, why (a path outside the project folder is refused). Up to 60 files, 12 of a kind. A cut with no `film` joins a film in play, never one the user shelved; naming a shelved film (or having only shelved films) brings it back, and the reply lists it in `restored`.",
|
|
118
118
|
inputSchema: {
|
|
119
119
|
project,
|
|
120
120
|
files: z.array(bringInItem).min(1).max(BRING_IN_MAX).describe("Each: path (absolute or relative to the project), kind when the name doesn't say, round for a voice read."),
|
|
@@ -146,12 +146,12 @@ export function createMcpServer(ctx) {
|
|
|
146
146
|
}, safe(async ({ project, video, version }) => (await ctx.client(project)).put(`/api/videos/${encodeURIComponent(video)}/lock`, { version })));
|
|
147
147
|
server.registerTool("rushes_status", {
|
|
148
148
|
title: "Rushes status",
|
|
149
|
-
description: "Which tabs are unlocked and how many open items each has. Also `brief`: whether brief.md exists, its status (draft or approved, set when the user presses Approve) and how many sections the user changed; `storyboard`: whether storyboard.md exists, how many shots there are, how many are approved and how many the user changed; and `build`: whether planning has begun (`started`), whether the brief, every script section (when there is a script) and every shot are approved (`ready`), and what it is `waitingOn`.",
|
|
149
|
+
description: "Which tabs are unlocked and how many open items each has. Also `brief`: whether brief.md exists, its status (draft or approved, set when the user presses Approve) and how many sections the user changed; `storyboard`: whether storyboard.md exists, how many shots there are, how many are approved and how many the user changed; and `build`: whether planning has begun (`started`), whether the brief, every script section (when there is a script) and every shot are approved (`ready`), and what it is `waitingOn`. Also `films`: every film with `shelved` (the time the user shelved it, or null). A shelved film is one the user has set aside: leave it alone, make no new cuts of it and fix none of its notes unless the user says to. Its open notes are not counted in the tabs.",
|
|
150
150
|
inputSchema: { project },
|
|
151
151
|
}, safe(async ({ project }) => (await ctx.client(project)).get("/api/tabs")));
|
|
152
152
|
server.registerTool("rushes_add_version", {
|
|
153
153
|
title: "Add a cut",
|
|
154
|
-
description: "Register a new cut of a video. The first cut creates the video. Returns the new version id (v1, v2 ...). When the cut is likely to play badly in a browser (4K, over 1.5 GB, or a codec such as ProRes), it also returns proxySuggested: true and proxyReason; Picture offers the user a proxy. If the project has autoProxy on, proxyJob is the proxy already being made. Give every cut a short `label` (" + LABEL_MAX + " characters at most) saying what changed, e.g. \"launch 1.45x slower\", and put the detail in `note`: the version list shows the label. Pass `formats` to register the other shapes of the same cut in one call; the reply then carries `formatWarnings` (a list, one entry for each shape more than 0.1 s off the cut's length; `warning` here means Picture is locked). When the plan (brief, script, storyboard) has been started but is not all approved, it carries `planWarning` saying what is outstanding: a nudge, never a refusal. A film's first cut also starts with the storyboard's shots.",
|
|
154
|
+
description: "Register a new cut of a video. The first cut creates the video. Returns the new version id (v1, v2 ...). When the cut is likely to play badly in a browser (4K, over 1.5 GB, or a codec such as ProRes), it also returns proxySuggested: true and proxyReason; Picture offers the user a proxy. If the project has autoProxy on, proxyJob is the proxy already being made. Give every cut a short `label` (" + LABEL_MAX + " characters at most) saying what changed, e.g. \"launch 1.45x slower\", and put the detail in `note`: the version list shows the label. Pass `formats` to register the other shapes of the same cut in one call; the reply then carries `formatWarnings` (a list, one entry for each shape more than 0.1 s off the cut's length; `warning` here means Picture is locked). When the plan (brief, script, storyboard) has been started but is not all approved, it carries `planWarning` saying what is outstanding: a nudge, never a refusal. A film's first cut also starts with the storyboard's shots. A cut of a shelved film brings it back (the reply has `restored: true`), so make one only when the user wants that film worked on again.",
|
|
155
155
|
inputSchema: {
|
|
156
156
|
project,
|
|
157
157
|
video: z.string().describe("Video id or name, e.g. \"Hero 60s\"."),
|
|
@@ -284,7 +284,7 @@ export function createMcpServer(ctx) {
|
|
|
284
284
|
}, safe(async ({ project, section, file }) => (await ctx.client(project)).post(`/api/script/${encodeURIComponent(section)}/takes`, { file })));
|
|
285
285
|
server.registerTool("rushes_list_notes", {
|
|
286
286
|
title: "List notes",
|
|
287
|
-
description: "Notes left in Rushes, filtered by tab, status, batch or version. A note's `on` says what it's about: null on Picture or for the whole mix, \"<lane>/<variant>\" for a music bed, SFX pass or voice variant, \"<lane>/<variant>:<cue>\" for an SFX cue, \"vo\" for the VO lane on Mix. Older notes may carry a bare variant id, \"vo\" for the assembled read, \"<section>:<take>\" for a take, or a section id. On Picture, a note's `format` is null when it's for every format, or a format id such as \"9x16\" when it's for that shape only.",
|
|
287
|
+
description: "Notes left in Rushes, filtered by tab, status, batch or version. A note's `on` says what it's about: null on Picture or for the whole mix, \"<lane>/<variant>\" for a music bed, SFX pass or voice variant, \"<lane>/<variant>:<cue>\" for an SFX cue, \"vo\" for the VO lane on Mix. Older notes may carry a bare variant id, \"vo\" for the assembled read, \"<section>:<take>\" for a take, or a section id. On Picture, a note's `format` is null when it's for every format, or a format id such as \"9x16\" when it's for that shape only. Notes on a shelved film (one the user has set aside) are left out.",
|
|
288
288
|
inputSchema: {
|
|
289
289
|
project,
|
|
290
290
|
stage: stage.optional(),
|
|
@@ -337,9 +337,9 @@ export function createMcpServer(ctx) {
|
|
|
337
337
|
}, safe(async ({ project, kind }) => (await ctx.client(project)).get(`/api/assets${kind ? `?kind=${encodeURIComponent(kind)}` : ""}`)));
|
|
338
338
|
server.registerTool("rushes_get_picks", {
|
|
339
339
|
title: "Get picks",
|
|
340
|
-
description: "Which variant is in use per audio lane (per round on Voiceover), and each Mix lane's level in dB (where the user wants voice, music and sfx to sit). Section take picks are kept for older projects but not used.",
|
|
341
|
-
inputSchema: { project },
|
|
342
|
-
}, safe(async ({ project }) => (await ctx.client(project)).get(
|
|
340
|
+
description: "Which variant is in use per audio lane (per round on Voiceover), and each Mix lane's level in dB (where the user wants voice, music and sfx to sit). Picks and levels belong to one film: pass `video` (the film's id, as in the note you are fixing) to read that film's own; without it you get the whole file, each film's under `videos`. Section take picks are kept for older projects but not used.",
|
|
341
|
+
inputSchema: { project, video: z.string().optional().describe("The film's id. Picks and levels are per film.") },
|
|
342
|
+
}, safe(async ({ project, video }) => (await ctx.client(project)).get(`/api/picks${video ? `?video=${encodeURIComponent(video)}` : ""}`)));
|
|
343
343
|
server.registerTool("rushes_add_file", {
|
|
344
344
|
title: "Add a file to the library",
|
|
345
345
|
description: "Register a project file (a doc, image, caption, export, delivery or edit file) in the Assets library, so it's listed, can be revealed, downloaded and opened. Docs, text and PDFs at the project root, captions at the root, and anything in exports/ are found automatically; other files need this.",
|
package/dist/server/app.js
CHANGED
|
@@ -2,7 +2,7 @@ import { Hono } from "hono";
|
|
|
2
2
|
import { streamSSE } from "hono/streaming";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { RushesError, InvalidError, NotFoundError } from "../core/errors.js";
|
|
5
|
-
import { addFile, addFormat, addVariant, addVersion, ensureProjectIdOnce, lockPicture, resolveCut, resolveVideo, setShots, shotAt } from "../core/project.js";
|
|
5
|
+
import { addFile, addFormat, addVariant, addVersion, ensureProjectIdOnce, lockPicture, noteInPlay, resolveCut, resolveVideo, setShots, shelveFilm, shotAt } from "../core/project.js";
|
|
6
6
|
import { addTake, editSection, setSections } from "../core/script.js";
|
|
7
7
|
import { addNote, applyReply, applyUserEdit, checkNoteFormat, filterNotes } from "../core/notes.js";
|
|
8
8
|
import { FORMAT_ID_RE, MAX_FORMATS, isPictureSize, labelOfId, versionFormats } from "../core/formats.js";
|
|
@@ -24,16 +24,16 @@ import { GRAB_PATH, OUTSIDE_CUT_EXT, OUTSIDE_MEDIA_EXT, SCREENSHOT_PATH, content
|
|
|
24
24
|
import { BRING_IN_MAX, FoundScanner, ffprobeDuration, foundAnnouncer } from "./found.js";
|
|
25
25
|
import { candidatePaths, listAssets, fpsFor, screenshotName } from "./assets.js";
|
|
26
26
|
import { osRevealer, osOpener, OPEN_SAFE_EXT } from "./reveal.js";
|
|
27
|
-
import { LaneStageSchema, SectionStatusSchema, StageSchema, BoxSchema, PinSchema, FileKindSchema, MarkSchema, ProjectIdSchema, ShotSchema, LEVEL_MIN, LEVEL_MAX, LEVEL_STEP } from "../core/schema.js";
|
|
27
|
+
import { LaneStageSchema, SectionStatusSchema, StageSchema, BoxSchema, PinSchema, FileKindSchema, MarkSchema, ProjectIdSchema, ShotSchema, LEVEL_MIN, LEVEL_MAX, LEVEL_STEP, picksForVideo } from "../core/schema.js";
|
|
28
28
|
import { LABEL_MAX, oneLineOf } from "../core/labels.js";
|
|
29
29
|
import { byOf, logBookFor } from "./logbook.js";
|
|
30
30
|
import { BriefService } from "./brief.js";
|
|
31
31
|
import { StoryboardService } from "./storyboard.js";
|
|
32
32
|
import { buildState, planWarning } from "../core/plan.js";
|
|
33
|
-
import { broughtInEvent, cutEvent, fileEvent, formatEvent, lineEvent, lockEvent, notesSentEvent, picksEvent, repliesEvent, scriptEvent, takeEvent, variantEvent, visualEvent, } from "../core/logEvents.js";
|
|
33
|
+
import { broughtInEvent, cutEvent, fileEvent, filmEvent, formatEvent, lineEvent, lockEvent, notesSentEvent, picksEvent, repliesEvent, scriptEvent, takeEvent, variantEvent, visualEvent, } from "../core/logEvents.js";
|
|
34
34
|
import { LOG_AREAS, LOG_MAX, changeLogFileName, logText, recentChanges } from "../core/logText.js";
|
|
35
35
|
import { defaultRunner, measureMix } from "./loudness.js";
|
|
36
|
-
export const VERSION = "0.
|
|
36
|
+
export const VERSION = "0.7.1";
|
|
37
37
|
async function body(c, schema) {
|
|
38
38
|
let json;
|
|
39
39
|
try {
|
|
@@ -168,7 +168,7 @@ const PickMap = z.record(z.string(), z.string().nullable());
|
|
|
168
168
|
// §19.6: a level is −24..6 dB in 0.5 dB steps; null resets it to 0 (removes the key).
|
|
169
169
|
const LevelValue = z.number().min(LEVEL_MIN).max(LEVEL_MAX).multipleOf(LEVEL_STEP);
|
|
170
170
|
const LevelsBody = z.object({ voice: LevelValue.nullable(), music: LevelValue.nullable(), sfx: LevelValue.nullable() }).partial();
|
|
171
|
-
const PicksBody = z.object({ lanes: PickMap.optional(), sections: PickMap.optional(), levels: LevelsBody.optional() });
|
|
171
|
+
const PicksBody = z.object({ video: z.string().min(1).max(200).optional(), lanes: PickMap.optional(), sections: PickMap.optional(), levels: LevelsBody.optional() });
|
|
172
172
|
const BatchBody = z.object({ stage: StageSchema });
|
|
173
173
|
const NoteQuery = z.object({
|
|
174
174
|
stage: StageSchema.optional(),
|
|
@@ -178,6 +178,8 @@ const NoteQuery = z.object({
|
|
|
178
178
|
// §21.4: a format's notes, with the all-format notes unless onlyThisFormat (R14: Picture only).
|
|
179
179
|
format: formatId.optional(),
|
|
180
180
|
onlyThisFormat: z.enum(["true", "false"]).optional(),
|
|
181
|
+
// §26: the notes of a shelved film are left out unless asked for (or a batch is: it lists what it sent).
|
|
182
|
+
includeShelved: z.enum(["true", "false"]).optional(),
|
|
181
183
|
});
|
|
182
184
|
// ShotSchema's own limits (name trimmed 1-80 chars, tag at most 24) apply at the boundary; `n` is server-assigned.
|
|
183
185
|
const ShotsBody = z.object({
|
|
@@ -185,7 +187,8 @@ const ShotsBody = z.object({
|
|
|
185
187
|
shots: z.array(ShotSchema.omit({ n: true })).max(200),
|
|
186
188
|
});
|
|
187
189
|
const LockBody = z.object({ version: z.string().nullable() });
|
|
188
|
-
const
|
|
190
|
+
const ShelveBody = z.object({ shelved: z.boolean() });
|
|
191
|
+
const MixLoudnessBody = z.object({ lanes: z.array(LaneStageSchema).min(1), video: z.string().min(1).max(200).optional() });
|
|
189
192
|
const SettingsBody = z.object({ autoProxy: z.boolean() }).strict();
|
|
190
193
|
// A time in seconds, 0 to 24 h: an empty value, NaN, Infinity or anything huge is a 400.
|
|
191
194
|
const FrameQuery = z.object({
|
|
@@ -692,6 +695,8 @@ export function createApp(store, opts = {}) {
|
|
|
692
695
|
let skipKinds = kinds;
|
|
693
696
|
if (b.include?.length) {
|
|
694
697
|
const included = await found.bringIn(b.include, { film: b.film, origin: "include" });
|
|
698
|
+
for (const f of included.restored ?? [])
|
|
699
|
+
await log.add(() => filmEvent(f, false), by(c));
|
|
695
700
|
if (included.added.length)
|
|
696
701
|
await log.add(() => broughtInEvent(included.added, null), by(c));
|
|
697
702
|
// An included cut becomes the cut the scoring is matched to, and a project with no cut
|
|
@@ -737,6 +742,8 @@ export function createApp(store, opts = {}) {
|
|
|
737
742
|
app.post("/api/found/bring-in", async (c) => {
|
|
738
743
|
const b = await body(c, FoundBringInBody);
|
|
739
744
|
const r = await found.bringIn(b.files, { film: b.film });
|
|
745
|
+
for (const f of r.restored ?? [])
|
|
746
|
+
await log.add(() => filmEvent(f, false), by(c));
|
|
740
747
|
if (r.added.length)
|
|
741
748
|
await log.add(() => broughtInEvent(r.added, null), by(c));
|
|
742
749
|
return c.json(r);
|
|
@@ -756,6 +763,8 @@ export function createApp(store, opts = {}) {
|
|
|
756
763
|
const [b, sb] = await Promise.all([brief.view(), storyboard.view()]);
|
|
757
764
|
return c.json({
|
|
758
765
|
tabs: tabStates(project, script, notes, visuals),
|
|
766
|
+
// §26: every film and whether it is shelved, so an agent leaves the shelved ones alone.
|
|
767
|
+
films: project.videos.map((v) => ({ id: v.id, name: v.name, shelved: v.shelved ?? null })),
|
|
759
768
|
brief: { exists: b.exists, status: b.status, changed: b.changed },
|
|
760
769
|
storyboard: { exists: sb.exists, shots: sb.total, approved: sb.approved, changed: sb.changed },
|
|
761
770
|
build: buildState({ brief: b, script: script.sections, storyboard: sb }),
|
|
@@ -786,8 +795,9 @@ export function createApp(store, opts = {}) {
|
|
|
786
795
|
const q = NoteQuery.safeParse(c.req.query());
|
|
787
796
|
if (!q.success)
|
|
788
797
|
throw new InvalidError("Query is invalid", q.error.issues);
|
|
789
|
-
const [{ notes }, visuals] = await Promise.all([store.read("notes"), store.read("visuals")]);
|
|
790
|
-
|
|
798
|
+
const [{ notes }, visuals, project] = await Promise.all([store.read("notes"), store.read("visuals"), store.read("project")]);
|
|
799
|
+
const listed = filterNotes(notes, { ...q.data, onlyThisFormat: q.data.onlyThisFormat === "true" }).filter((n) => q.data.includeShelved === "true" || q.data.batch !== undefined || noteInPlay(n, project));
|
|
800
|
+
return c.json({ notes: withVisualViews(listed, visuals) });
|
|
791
801
|
});
|
|
792
802
|
app.post("/api/notes", async (c) => {
|
|
793
803
|
const b = await body(c, NewNoteBody);
|
|
@@ -875,6 +885,7 @@ export function createApp(store, opts = {}) {
|
|
|
875
885
|
let lockedVersion = null;
|
|
876
886
|
let autoProxy = false;
|
|
877
887
|
let films = 1;
|
|
888
|
+
let restored = false;
|
|
878
889
|
const { result } = await store.update("project", (p) => {
|
|
879
890
|
const out = addVersion(p, {
|
|
880
891
|
video: b.video, file, note: b.note, label: b.label, duration: info.duration ?? read?.duration ?? null, fps: info.fps ?? read?.fps ?? null,
|
|
@@ -904,6 +915,7 @@ export function createApp(store, opts = {}) {
|
|
|
904
915
|
setShots(p, out.video.id, out.version.id, reachable);
|
|
905
916
|
}
|
|
906
917
|
lockedVersion = out.video.lockedVersion;
|
|
918
|
+
restored = out.restored;
|
|
907
919
|
autoProxy = p.autoProxy;
|
|
908
920
|
films = p.videos.length;
|
|
909
921
|
if (info.fps && p.videos.length === 1 && p.videos[0].versions.length === 1)
|
|
@@ -912,6 +924,9 @@ export function createApp(store, opts = {}) {
|
|
|
912
924
|
});
|
|
913
925
|
// One write, one line (R4): a cut that comes with its other shapes says so on its own line
|
|
914
926
|
// ("v2 and its 9:16 added: …"), rather than a line per shape.
|
|
927
|
+
// §26: a cut on a shelved film brings it back; the Change Log says so, then says what was added.
|
|
928
|
+
if (restored)
|
|
929
|
+
await log.add(() => filmEvent(result.video, false), by(c));
|
|
915
930
|
await log.add(() => cutEvent(films, result.video, result.version, result.version.formats.map((f) => f.label)), by(c));
|
|
916
931
|
// §19.5: say when the cut is likely to play badly, and start its proxy straight away when the
|
|
917
932
|
// project asks for that. Without ffmpeg, nothing is offered (needFor is null).
|
|
@@ -928,9 +943,10 @@ export function createApp(store, opts = {}) {
|
|
|
928
943
|
// §24.12: a soft nudge, never a refusal: the plan (brief, script, storyboard) is not all approved yet.
|
|
929
944
|
const planNote = planWarning(await planBuild());
|
|
930
945
|
const warnings = { ...(formatWarnings.length ? { formatWarnings } : {}), ...(planNote ? { planWarning: planNote } : {}) };
|
|
946
|
+
const reply = { video: result.video, version: result.version, ...(restored ? { restored: true } : {}) };
|
|
931
947
|
if (lockedVersion)
|
|
932
|
-
return c.json({ ...
|
|
933
|
-
return c.json({ ...
|
|
948
|
+
return c.json({ ...reply, ...proxy, ...warnings, warning: `Picture is locked at ${lockedVersion}` }, 201);
|
|
949
|
+
return c.json({ ...reply, ...proxy, ...warnings }, 201);
|
|
934
950
|
});
|
|
935
951
|
// ---- formats (§21.4) ----
|
|
936
952
|
app.post("/api/formats", async (c) => {
|
|
@@ -1096,6 +1112,18 @@ export function createApp(store, opts = {}) {
|
|
|
1096
1112
|
await log.add(() => lockEvent(films, result), by(c));
|
|
1097
1113
|
return c.json({ video: result });
|
|
1098
1114
|
});
|
|
1115
|
+
// §26: shelve a film, or restore it. The same call twice is the same as once, and only a change is logged.
|
|
1116
|
+
app.put("/api/videos/:video/shelve", async (c) => {
|
|
1117
|
+
const b = await body(c, ShelveBody);
|
|
1118
|
+
let before = false;
|
|
1119
|
+
const { result } = await store.update("project", (p) => {
|
|
1120
|
+
before = !!resolveVideo(p, c.req.param("video")).shelved;
|
|
1121
|
+
return shelveFilm(p, c.req.param("video"), b.shelved);
|
|
1122
|
+
});
|
|
1123
|
+
if (!!result.shelved !== before)
|
|
1124
|
+
await log.add(() => filmEvent(result, b.shelved), by(c));
|
|
1125
|
+
return c.json({ video: result });
|
|
1126
|
+
});
|
|
1099
1127
|
app.post("/api/variants", async (c) => {
|
|
1100
1128
|
const b = await body(c, VariantBody);
|
|
1101
1129
|
// §23: a cue's file is stored as a manifest path, like the variant's own.
|
|
@@ -1133,7 +1161,12 @@ export function createApp(store, opts = {}) {
|
|
|
1133
1161
|
return c.json({ take: result }, 201);
|
|
1134
1162
|
});
|
|
1135
1163
|
// ---- picks ----
|
|
1136
|
-
|
|
1164
|
+
// ?video=<id> reads one film's picks as a plain picks file (lanes and levels are that film's own).
|
|
1165
|
+
app.get("/api/picks", async (c) => {
|
|
1166
|
+
const picks = await store.read("picks");
|
|
1167
|
+
const video = c.req.query("video");
|
|
1168
|
+
return c.json(video ? picksForVideo(picks, video) : picks);
|
|
1169
|
+
});
|
|
1137
1170
|
app.put("/api/picks", async (c) => {
|
|
1138
1171
|
const b = await body(c, PicksBody);
|
|
1139
1172
|
// Merged key by key: a string sets that pick, null removes it, anything not named is kept.
|
|
@@ -1145,11 +1178,7 @@ export function createApp(store, opts = {}) {
|
|
|
1145
1178
|
into[k] = v;
|
|
1146
1179
|
}
|
|
1147
1180
|
};
|
|
1148
|
-
|
|
1149
|
-
const { data } = await store.update("picks", (p) => {
|
|
1150
|
-
before = { ...p.lanes };
|
|
1151
|
-
merge(p.lanes, b.lanes);
|
|
1152
|
-
merge(p.sections, b.sections);
|
|
1181
|
+
const mergeLevels = (into) => {
|
|
1153
1182
|
// §19.6: same merge rule as lanes/sections -- a number sets the level, null resets it to 0
|
|
1154
1183
|
// (deletes the key), anything not named is kept.
|
|
1155
1184
|
for (const stage of ["voice", "music", "sfx"]) {
|
|
@@ -1157,29 +1186,45 @@ export function createApp(store, opts = {}) {
|
|
|
1157
1186
|
if (v === undefined)
|
|
1158
1187
|
continue;
|
|
1159
1188
|
if (v === null)
|
|
1160
|
-
delete
|
|
1189
|
+
delete into[stage];
|
|
1161
1190
|
else
|
|
1162
|
-
|
|
1191
|
+
into[stage] = v;
|
|
1192
|
+
}
|
|
1193
|
+
};
|
|
1194
|
+
let before = {};
|
|
1195
|
+
const { data } = await store.update("picks", (p) => {
|
|
1196
|
+
merge(p.sections, b.sections);
|
|
1197
|
+
if (b.video) {
|
|
1198
|
+
// A film's picks and levels are its own: another film's are never touched.
|
|
1199
|
+
const own = (p.videos[b.video] ??= { lanes: {}, levels: {} });
|
|
1200
|
+
before = { ...own.lanes };
|
|
1201
|
+
merge(own.lanes, b.lanes);
|
|
1202
|
+
mergeLevels(own.levels);
|
|
1203
|
+
return;
|
|
1163
1204
|
}
|
|
1205
|
+
before = { ...p.lanes };
|
|
1206
|
+
merge(p.lanes, b.lanes);
|
|
1207
|
+
mergeLevels(p.levels);
|
|
1164
1208
|
});
|
|
1209
|
+
const now = b.video ? (data.videos[b.video]?.lanes ?? {}) : data.lanes;
|
|
1165
1210
|
// §22.5: a change of what's picked is logged; levels alone aren't (R10).
|
|
1166
|
-
const changed = Object.keys({ ...before, ...
|
|
1211
|
+
const changed = Object.keys({ ...before, ...now }).some((k) => before[k] !== now[k]);
|
|
1167
1212
|
if (changed) {
|
|
1168
1213
|
// The names come from project.json; if it can't be read now, the pick still stands (ruling e).
|
|
1169
1214
|
const project = await store.read("project").catch(() => null);
|
|
1170
1215
|
if (project)
|
|
1171
|
-
await log.add(() => picksEvent(project,
|
|
1216
|
+
await log.add(() => picksEvent(project, now, project.videos.find((v) => v.id === b.video)), by(c));
|
|
1172
1217
|
else
|
|
1173
1218
|
log.failures += 1;
|
|
1174
1219
|
}
|
|
1175
|
-
return c.json(data);
|
|
1220
|
+
return c.json(b.video ? picksForVideo(data, b.video) : data);
|
|
1176
1221
|
});
|
|
1177
1222
|
// ---- mix loudness (§17.6) ----
|
|
1178
1223
|
app.post("/api/mix/loudness", async (c) => {
|
|
1179
1224
|
const b = await body(c, MixLoudnessBody);
|
|
1180
1225
|
const [project, picks] = await Promise.all([store.read("project"), store.read("picks")]);
|
|
1181
1226
|
const run = opts.loudnessRunner ?? defaultRunner;
|
|
1182
|
-
const result = await measureMix(project, picks, b.lanes, store.root, run, opts.loudnessTimeoutMs);
|
|
1227
|
+
const result = await measureMix(project, picksForVideo(picks, b.video), b.lanes, store.root, run, opts.loudnessTimeoutMs);
|
|
1183
1228
|
return c.json(result);
|
|
1184
1229
|
});
|
|
1185
1230
|
// ---- batches ----
|