@nodaro/cli 1.34.0 → 1.35.0
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/dist/index.js +184 -35
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { Command, Option } from 'commander';
|
|
3
3
|
import { createInterface } from 'readline/promises';
|
|
4
4
|
import { stdout, stdin } from 'process';
|
|
5
|
-
import
|
|
5
|
+
import pc5 from 'picocolors';
|
|
6
6
|
import { writeFileSync, readFileSync, existsSync, mkdirSync, chmodSync } from 'fs';
|
|
7
7
|
import { hostname, platform, homedir } from 'os';
|
|
8
8
|
import { join } from 'path';
|
|
@@ -41,7 +41,7 @@ var require_package = __commonJS({
|
|
|
41
41
|
"package.json"(exports$1, module) {
|
|
42
42
|
module.exports = {
|
|
43
43
|
name: "@nodaro/cli",
|
|
44
|
-
version: "1.
|
|
44
|
+
version: "1.35.0",
|
|
45
45
|
description: "Command-line interface for Nodaro \u2014 list and run workflows, inspect jobs and executions, manage projects from the terminal.",
|
|
46
46
|
type: "module",
|
|
47
47
|
license: "Apache-2.0",
|
|
@@ -82,8 +82,8 @@ var require_package = __commonJS({
|
|
|
82
82
|
"@inquirer/confirm": "^6.0.12",
|
|
83
83
|
"@inquirer/input": "^5.0.12",
|
|
84
84
|
"@inquirer/select": "^5.1.4",
|
|
85
|
-
"@nodaro/sdk": "^2.
|
|
86
|
-
"@nodaro/shared": "^3.
|
|
85
|
+
"@nodaro/sdk": "^2.33.0",
|
|
86
|
+
"@nodaro/shared": "^3.37.0",
|
|
87
87
|
commander: "^12.1.0",
|
|
88
88
|
picocolors: "^1.1.1",
|
|
89
89
|
"@nodaro/prompts": "^1.40.0"
|
|
@@ -173,20 +173,20 @@ function detail(value) {
|
|
|
173
173
|
console.log(JSON.stringify(value, null, 2));
|
|
174
174
|
}
|
|
175
175
|
function success(line) {
|
|
176
|
-
console.log(
|
|
176
|
+
console.log(pc5.green("\u2713") + " " + line);
|
|
177
177
|
}
|
|
178
178
|
function info(line) {
|
|
179
179
|
console.log(line);
|
|
180
180
|
}
|
|
181
181
|
function dim(line) {
|
|
182
|
-
console.log(
|
|
182
|
+
console.log(pc5.dim(line));
|
|
183
183
|
}
|
|
184
184
|
function warn(line) {
|
|
185
|
-
console.error(
|
|
185
|
+
console.error(pc5.yellow("\u26A0") + " " + line);
|
|
186
186
|
}
|
|
187
187
|
function table(rows2, columns) {
|
|
188
188
|
if (rows2.length === 0) {
|
|
189
|
-
console.log(
|
|
189
|
+
console.log(pc5.dim("(empty)"));
|
|
190
190
|
return;
|
|
191
191
|
}
|
|
192
192
|
const widths = {};
|
|
@@ -198,7 +198,7 @@ function table(rows2, columns) {
|
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
200
|
for (const col of columns) widths[col] = Math.min(widths[col], 60);
|
|
201
|
-
console.log(columns.map((c) =>
|
|
201
|
+
console.log(columns.map((c) => pc5.bold(c.padEnd(widths[c]))).join(" "));
|
|
202
202
|
console.log(columns.map((c) => "-".repeat(widths[c])).join(" "));
|
|
203
203
|
for (const row of rows2) {
|
|
204
204
|
console.log(
|
|
@@ -362,7 +362,7 @@ function authCommand() {
|
|
|
362
362
|
if (opts.json) {
|
|
363
363
|
emit({ profile: name, baseUrl: profile.baseUrl, tokenMasked: maskToken(profile.token), signedIn: true }, opts);
|
|
364
364
|
} else {
|
|
365
|
-
info(`profile: ${
|
|
365
|
+
info(`profile: ${pc5.cyan(name)}`);
|
|
366
366
|
info(`baseUrl: ${profile.baseUrl}`);
|
|
367
367
|
info(`token: ${maskToken(profile.token)}`);
|
|
368
368
|
}
|
|
@@ -413,7 +413,7 @@ function saveWorkspace(profileName, workspaceId) {
|
|
|
413
413
|
}
|
|
414
414
|
|
|
415
415
|
// src/client.ts
|
|
416
|
-
var CLI_VERSION = "1.
|
|
416
|
+
var CLI_VERSION = "1.35.0" ;
|
|
417
417
|
function buildPublicClient(opts = {}) {
|
|
418
418
|
const { profile } = getProfile(opts.profile);
|
|
419
419
|
return createClient({
|
|
@@ -425,8 +425,8 @@ function buildPublicClient(opts = {}) {
|
|
|
425
425
|
function buildClient(profileName) {
|
|
426
426
|
const { name, profile } = getProfile(profileName);
|
|
427
427
|
if (!profile) {
|
|
428
|
-
console.error(
|
|
429
|
-
console.error(
|
|
428
|
+
console.error(pc5.red(`\u2717 no credentials for profile "${name}"`));
|
|
429
|
+
console.error(pc5.dim(` run: nodaro auth login${profileName ? ` --profile ${profileName}` : ""}`));
|
|
430
430
|
process.exit(1);
|
|
431
431
|
}
|
|
432
432
|
const { workspaceId } = resolveWorkspace(profile);
|
|
@@ -443,20 +443,20 @@ function buildClient(profileName) {
|
|
|
443
443
|
}
|
|
444
444
|
function handleError(err) {
|
|
445
445
|
if (err instanceof UnauthorizedError) {
|
|
446
|
-
console.error(
|
|
447
|
-
console.error(
|
|
446
|
+
console.error(pc5.red("\u2717 unauthorized \u2014 token missing, expired, or invalid"));
|
|
447
|
+
console.error(pc5.dim(" run: nodaro auth login"));
|
|
448
448
|
process.exit(1);
|
|
449
449
|
}
|
|
450
450
|
if (err instanceof NodaroError) {
|
|
451
|
-
console.error(
|
|
452
|
-
if (err.code) console.error(
|
|
451
|
+
console.error(pc5.red(`\u2717 ${err.message}`));
|
|
452
|
+
if (err.code) console.error(pc5.dim(` code: ${err.code}`));
|
|
453
453
|
process.exit(1);
|
|
454
454
|
}
|
|
455
455
|
if (err instanceof Error) {
|
|
456
|
-
console.error(
|
|
456
|
+
console.error(pc5.red(`\u2717 ${err.message}`));
|
|
457
457
|
process.exit(1);
|
|
458
458
|
}
|
|
459
|
-
console.error(
|
|
459
|
+
console.error(pc5.red("\u2717 unknown error"), err);
|
|
460
460
|
process.exit(1);
|
|
461
461
|
}
|
|
462
462
|
|
|
@@ -6776,7 +6776,7 @@ function workspaceCommand() {
|
|
|
6776
6776
|
emit({ profile: name, workspaceId: workspaceId ?? null, source }, opts);
|
|
6777
6777
|
return;
|
|
6778
6778
|
}
|
|
6779
|
-
info(`profile: ${
|
|
6779
|
+
info(`profile: ${pc5.cyan(name)}`);
|
|
6780
6780
|
info(`workspace: ${workspaceId ?? "(personal space)"}`);
|
|
6781
6781
|
if (!profile) {
|
|
6782
6782
|
warn(`no credentials for profile "${name}" \u2014 run: nodaro auth login`);
|
|
@@ -6959,6 +6959,63 @@ function refuseUnknownPlanTier(planTier) {
|
|
|
6959
6959
|
process.exit(1);
|
|
6960
6960
|
}
|
|
6961
6961
|
}
|
|
6962
|
+
|
|
6963
|
+
// src/commands/edit-recordings.ts
|
|
6964
|
+
function withRecordingsOptions(cmd) {
|
|
6965
|
+
return cmd.requiredOption(
|
|
6966
|
+
"--media <url>",
|
|
6967
|
+
"the recording (video or audio URL, up to 3 hours); repeat it for the cameras of one conversation, in order (several need Speaker Map)",
|
|
6968
|
+
collectVariadic
|
|
6969
|
+
).option("--master-audio <url>", "the mixer or recorder track: the episode's sound and the clock the recordings are lined up to (needs Speaker Map)").option("--wide-camera <n>", "with several recordings: which --media (1-based) is the wide shot").option("--synced", "with several recordings: they already share one clock, skip lining them up").option(
|
|
6970
|
+
"--speaker-camera <speaker=recording>",
|
|
6971
|
+
"with several recordings: put a speaker (1 = the first voice heard) on a --media number, 0 = the wide shot (repeatable)",
|
|
6972
|
+
collectVariadic
|
|
6973
|
+
);
|
|
6974
|
+
}
|
|
6975
|
+
var WHOLE = /^\d+$/;
|
|
6976
|
+
function recordingsInput(opts) {
|
|
6977
|
+
const several = opts.media.length > 1 || opts.masterAudio !== void 0;
|
|
6978
|
+
const cameraFlags = opts.wideCamera !== void 0 || opts.synced === true || (opts.speakerCamera?.length ?? 0) > 0;
|
|
6979
|
+
if (cameraFlags && !several) {
|
|
6980
|
+
warn("--wide-camera, --synced and --speaker-camera apply with several --media or --master-audio only");
|
|
6981
|
+
process.exit(1);
|
|
6982
|
+
}
|
|
6983
|
+
let wide;
|
|
6984
|
+
if (opts.wideCamera !== void 0) {
|
|
6985
|
+
if (!WHOLE.test(opts.wideCamera) || Number(opts.wideCamera) < 1) {
|
|
6986
|
+
warn(`--wide-camera must be a recording number, 1 or more (got "${opts.wideCamera}")`);
|
|
6987
|
+
process.exit(1);
|
|
6988
|
+
}
|
|
6989
|
+
wide = Number(opts.wideCamera);
|
|
6990
|
+
}
|
|
6991
|
+
const speakerCameras = {};
|
|
6992
|
+
for (const pair of opts.speakerCamera ?? []) {
|
|
6993
|
+
const [speaker, recording, ...extra] = pair.split("=");
|
|
6994
|
+
if (extra.length > 0 || !speaker || !recording || !WHOLE.test(speaker) || !WHOLE.test(recording) || Number(speaker) < 1) {
|
|
6995
|
+
warn(`--speaker-camera must be <speaker>=<recording>: a speaker 1 or more, a --media number or 0 for the wide shot (got "${pair}")`);
|
|
6996
|
+
process.exit(1);
|
|
6997
|
+
}
|
|
6998
|
+
const key2 = String(Number(speaker));
|
|
6999
|
+
if (key2 in speakerCameras) {
|
|
7000
|
+
warn(`--speaker-camera names speaker ${key2} twice`);
|
|
7001
|
+
process.exit(1);
|
|
7002
|
+
}
|
|
7003
|
+
speakerCameras[key2] = Number(recording);
|
|
7004
|
+
}
|
|
7005
|
+
const cameras = {
|
|
7006
|
+
...wide !== void 0 ? { wide } : {},
|
|
7007
|
+
...opts.synced ? { synced: true } : {},
|
|
7008
|
+
...Object.keys(speakerCameras).length > 0 ? { speakerCameras } : {}
|
|
7009
|
+
};
|
|
7010
|
+
return {
|
|
7011
|
+
// One --media is the one-recording request it always was.
|
|
7012
|
+
...opts.media.length === 1 ? { mediaUrl: opts.media[0] } : { mediaUrls: [...opts.media] },
|
|
7013
|
+
...opts.masterAudio !== void 0 ? { masterAudioUrl: opts.masterAudio } : {},
|
|
7014
|
+
...Object.keys(cameras).length > 0 ? { cameras } : {}
|
|
7015
|
+
};
|
|
7016
|
+
}
|
|
7017
|
+
|
|
7018
|
+
// src/commands/edit-use-case.ts
|
|
6962
7019
|
var EMPHASIS_HELP = `none, or ${SPEAKER_EMPHASIS_STYLES.filter((s) => s !== "none").join(", ")} joined with "+" (each once)`;
|
|
6963
7020
|
var CONTINUATION_NEXT_STEP = {
|
|
6964
7021
|
already_running: (id) => ` \u2014 follow it: nodaro jobs get ${id}`,
|
|
@@ -6967,7 +7024,13 @@ var CONTINUATION_NEXT_STEP = {
|
|
|
6967
7024
|
};
|
|
6968
7025
|
function registerUseCaseCommands(cmd) {
|
|
6969
7026
|
const framingLayouts = ["auto", ...SPEAKER_LAYOUT_IDS];
|
|
6970
|
-
|
|
7027
|
+
const FRAMING_SOURCES = Object.keys({ auto: true, static: true, tracking: true });
|
|
7028
|
+
withRecordingsOptions(
|
|
7029
|
+
cmd.command("tighten-episode").description("tighten a podcast recording in one step (transcribe, cut silences, render; optional captions, music and framing)")
|
|
7030
|
+
).option("--music <url>", "optional music bed, ducked under the voice").option("--output <kind>", "video | audio (an audio recording always makes an audio episode)").option("--framing <aspect>", `frame a video episode on its speakers: ${EDL_TARGET_ASPECTS.join(" | ")}`).option("--layout <layout>", `layout with --framing (default auto): ${framingLayouts.join(" | ")}`).option(
|
|
7031
|
+
"--framing-source <source>",
|
|
7032
|
+
`with --framing, how it follows the speakers: ${FRAMING_SOURCES.join(" | ")} (default static: the even split; tracking follows faces with Speaker Frames, charged per started block of 1,000 sampled frames; auto follows faces while Speaker Frames is available to you)`
|
|
7033
|
+
).option("--no-captions", "no captions on a video episode").option("--review", "stop at a preview to review (render the final with `nodaro edit continue-use-case <jobId> --mode render-final`)").option("--plan-tier <tier>", EDIT_PLAN_TIERS.join(" | ")).option("--instructions <text>", "editing instructions for the planner").option("--watch", "poll the job until it finishes").option("--poll-interval <ms>", "poll interval with --watch", (v) => parseInt(v, 10)).option("--profile <name>").option("--json").action(
|
|
6971
7034
|
async (opts, command) => {
|
|
6972
7035
|
if (opts.output !== void 0 && opts.output !== "video" && opts.output !== "audio") {
|
|
6973
7036
|
warn(`--output must be "video" or "audio" (got "${opts.output}")`);
|
|
@@ -6986,13 +7049,23 @@ function registerUseCaseCommands(cmd) {
|
|
|
6986
7049
|
warn(`--layout must be ${framingLayouts.join(", ")} (got "${opts.layout}")`);
|
|
6987
7050
|
process.exit(1);
|
|
6988
7051
|
}
|
|
7052
|
+
if (opts.framingSource !== void 0 && opts.framing === void 0) {
|
|
7053
|
+
warn("--framing-source applies with --framing only (it picks how the framing follows the speakers)");
|
|
7054
|
+
process.exit(1);
|
|
7055
|
+
}
|
|
7056
|
+
if (opts.framingSource !== void 0 && !FRAMING_SOURCES.includes(opts.framingSource)) {
|
|
7057
|
+
warn(`--framing-source must be ${FRAMING_SOURCES.join(", ")} (got "${opts.framingSource}")`);
|
|
7058
|
+
process.exit(1);
|
|
7059
|
+
}
|
|
7060
|
+
const recordings = recordingsInput(opts);
|
|
6989
7061
|
try {
|
|
6990
7062
|
const client = buildClient(opts.profile);
|
|
6991
7063
|
const result = await client.edit.tightenEpisode({
|
|
6992
|
-
|
|
7064
|
+
...recordings,
|
|
6993
7065
|
...opts.music ? { musicUrl: opts.music } : {},
|
|
6994
7066
|
...opts.output ? { output: opts.output } : {},
|
|
6995
7067
|
...opts.framing ? { framing: { aspect: opts.framing, layout: opts.layout ?? "auto" } } : {},
|
|
7068
|
+
...opts.framingSource ? { framingSource: opts.framingSource } : {},
|
|
6996
7069
|
// commander's --no-captions defaults `captions` to true: send it only when turned off.
|
|
6997
7070
|
...opts.captions === false ? { captions: false } : {},
|
|
6998
7071
|
...opts.review ? { reviewBeforeRender: true } : {},
|
|
@@ -7037,7 +7110,9 @@ function registerUseCaseCommands(cmd) {
|
|
|
7037
7110
|
}
|
|
7038
7111
|
}
|
|
7039
7112
|
);
|
|
7040
|
-
|
|
7113
|
+
withRecordingsOptions(
|
|
7114
|
+
cmd.command("episode-trailer").description("cut a 20\u201340 second trailer of a recording and deliver it in each chosen social format, in one step")
|
|
7115
|
+
).option("--intro-card <url>", "an optional short video (15 s at most) played before the trailer").option("--formats <list>", `comma-separated, at least one: ${TRAILER_FORMATS.join(",")} (default 9:16,1:1,4:5)`).option("--review", "stop at a preview to review (render every format with `nodaro edit continue-use-case <jobId> --mode render-final`)").option("--plan-tier <tier>", EDIT_PLAN_TIERS.join(" | ")).option("--instructions <text>", "instructions for the trailer").option("--style-guide <text>", "a style guide for the plan").option("--idempotency-key <key>", "sent as Idempotency-Key: a retry with the same key answers the run already started").option("--watch", "poll the job until it finishes, then print each format's URL").option("--poll-interval <ms>", "poll interval with --watch", (v) => parseInt(v, 10)).option("--profile <name>").option("--json").action(
|
|
7041
7116
|
async (opts) => {
|
|
7042
7117
|
const formats = opts.formats?.split(",").map((f) => f.trim()).filter((f) => f.length > 0);
|
|
7043
7118
|
if (formats !== void 0 && (formats.length === 0 || formats.some((f) => !TRAILER_FORMATS.includes(f)))) {
|
|
@@ -7045,11 +7120,12 @@ function registerUseCaseCommands(cmd) {
|
|
|
7045
7120
|
process.exit(1);
|
|
7046
7121
|
}
|
|
7047
7122
|
refuseUnknownPlanTier(opts.planTier);
|
|
7123
|
+
const recordings = recordingsInput(opts);
|
|
7048
7124
|
try {
|
|
7049
7125
|
const client = buildClient(opts.profile);
|
|
7050
7126
|
const result = await client.edit.episodeTrailer(
|
|
7051
7127
|
{
|
|
7052
|
-
|
|
7128
|
+
...recordings,
|
|
7053
7129
|
...opts.introCard ? { introCardUrl: opts.introCard } : {},
|
|
7054
7130
|
...formats ? { formats } : {},
|
|
7055
7131
|
...opts.review ? { reviewBeforeRender: true } : {},
|
|
@@ -7074,14 +7150,19 @@ function registerUseCaseCommands(cmd) {
|
|
|
7074
7150
|
const failed = Array.isArray(out.failedFormats) ? out.failedFormats.filter((f) => typeof f === "string") : [];
|
|
7075
7151
|
if (failed.length > 0) console.log(`Could not render: ${failed.join(", ")}`);
|
|
7076
7152
|
}
|
|
7077
|
-
if (opts.review) console.log(
|
|
7153
|
+
if (opts.review) console.log(pc5.dim(` render every format after your review: nodaro edit continue-use-case ${result.jobId} --mode render-final`));
|
|
7078
7154
|
} catch (err) {
|
|
7079
7155
|
handleError(err);
|
|
7080
7156
|
}
|
|
7081
7157
|
}
|
|
7082
7158
|
);
|
|
7083
7159
|
const isWhole = (v, min, max) => v !== void 0 && /^\d+$/.test(v.trim()) && Number(v) >= min && Number(v) <= max;
|
|
7084
|
-
|
|
7160
|
+
withRecordingsOptions(
|
|
7161
|
+
cmd.command("clip-pack").description("cut a recording into a pack of short clips in one step (find the best moments, render each \u2014 framed and captioned by default; several cameras cut to the speaker in every clip)")
|
|
7162
|
+
).option("--count <n>", `how many clips, 1\u2013${EDIT_PLAN_MAX_CLIP_COUNT} (default 8; the plan may find fewer)`).option("--length <sec>", `each clip's target length in seconds, ${CLIP_PACK_MIN_TARGET_SEC}\u2013${CLIP_PACK_MAX_TARGET_SEC} (default 60)`).option("--framing <aspect>", `frame each clip on its speakers: ${EDL_TARGET_ASPECTS.join(" | ")}, or none for the recording's shape (default 9:16)`).option("--layout <layout>", `layout with --framing <aspect> (default stacked): ${framingLayouts.join(" | ")}`).option("--switch <id>", `the switch at each speaker change, with --framing <aspect> (default pan): cut | pan | zoom | xfade:<transition>, e.g. xfade:fade`).option("--emphasis <style>", `how the speaker talking is emphasised, with --framing <aspect> (default scale): ${EMPHASIS_HELP}`).option(
|
|
7163
|
+
"--framing-source <source>",
|
|
7164
|
+
`how the framing follows the speakers (not with --framing none): ${FRAMING_SOURCES.join(" | ")} (default static: the even split; tracking follows faces with one Speaker Frames run over the whole pack, charged per started block of 1,000 sampled frames; auto follows faces while Speaker Frames is available to you)`
|
|
7165
|
+
).option("--no-captions", "no captions on the clips").option("--caption-style <style>", `the captions' look (default karaoke): ${ALL_CAPTION_STYLES.join(" | ")}`).option("--review", "stop at previews to review (render the kept clips with `nodaro edit continue-use-case <jobId> --mode render-final`)").option("--plan-tier <tier>", EDIT_PLAN_TIERS.join(" | ")).option("--instructions <text>", "instructions for picking the clips").option("--style-guide <text>", "a style guide for the plan").option("--idempotency-key <key>", "sent as Idempotency-Key: a retry with the same key answers the run already started").option("--watch", "poll the job until it finishes, then print each clip's URL").option("--poll-interval <ms>", "poll interval with --watch", (v) => parseInt(v, 10)).option("--profile <name>").option("--json").action(
|
|
7085
7166
|
async (opts) => {
|
|
7086
7167
|
if (opts.count !== void 0 && !isWhole(opts.count, 1, EDIT_PLAN_MAX_CLIP_COUNT)) {
|
|
7087
7168
|
warn(`--count must be 1\u2013${EDIT_PLAN_MAX_CLIP_COUNT} (got "${opts.count}")`);
|
|
@@ -7117,6 +7198,14 @@ function registerUseCaseCommands(cmd) {
|
|
|
7117
7198
|
warn(`--emphasis must be ${EMPHASIS_HELP} (got "${opts.emphasis}")`);
|
|
7118
7199
|
process.exit(1);
|
|
7119
7200
|
}
|
|
7201
|
+
if (opts.framingSource !== void 0 && opts.framing === "none") {
|
|
7202
|
+
warn("--framing-source applies with a framing only (not with --framing none)");
|
|
7203
|
+
process.exit(1);
|
|
7204
|
+
}
|
|
7205
|
+
if (opts.framingSource !== void 0 && !FRAMING_SOURCES.includes(opts.framingSource)) {
|
|
7206
|
+
warn(`--framing-source must be ${FRAMING_SOURCES.join(", ")} (got "${opts.framingSource}")`);
|
|
7207
|
+
process.exit(1);
|
|
7208
|
+
}
|
|
7120
7209
|
if (opts.captionStyle !== void 0 && opts.captions === false) {
|
|
7121
7210
|
warn("--caption-style applies with captions on (drop --no-captions)");
|
|
7122
7211
|
process.exit(1);
|
|
@@ -7126,11 +7215,12 @@ function registerUseCaseCommands(cmd) {
|
|
|
7126
7215
|
process.exit(1);
|
|
7127
7216
|
}
|
|
7128
7217
|
refuseUnknownPlanTier(opts.planTier);
|
|
7218
|
+
const recordings = recordingsInput(opts);
|
|
7129
7219
|
try {
|
|
7130
7220
|
const client = buildClient(opts.profile);
|
|
7131
7221
|
const result = await client.edit.clipPack(
|
|
7132
7222
|
{
|
|
7133
|
-
|
|
7223
|
+
...recordings,
|
|
7134
7224
|
...opts.count !== void 0 ? { count: Number(opts.count) } : {},
|
|
7135
7225
|
...opts.length !== void 0 ? { targetDurationSec: Number(opts.length) } : {},
|
|
7136
7226
|
// none = the recording's shape; an aspect alone leaves the layout to the route (stacked).
|
|
@@ -7142,6 +7232,7 @@ function registerUseCaseCommands(cmd) {
|
|
|
7142
7232
|
...opts.emphasis ? { emphasisStyle: opts.emphasis } : {}
|
|
7143
7233
|
}
|
|
7144
7234
|
} : {},
|
|
7235
|
+
...opts.framingSource ? { framingSource: opts.framingSource } : {},
|
|
7145
7236
|
// commander's --no-captions defaults `captions` to true: send it only when turned off.
|
|
7146
7237
|
...opts.captions === false ? { captions: false } : {},
|
|
7147
7238
|
...opts.captionStyle ? { captionStyle: opts.captionStyle } : {},
|
|
@@ -7170,13 +7261,71 @@ function registerUseCaseCommands(cmd) {
|
|
|
7170
7261
|
const failed = typeof out.failedClips === "number" && out.failedClips > 0 ? out.failedClips : 0;
|
|
7171
7262
|
if (failed > 0) console.log(failed === 1 ? "1 clip could not be rendered." : `${failed} clips could not be rendered.`);
|
|
7172
7263
|
}
|
|
7173
|
-
if (opts.review) console.log(
|
|
7264
|
+
if (opts.review) console.log(pc5.dim(` render the kept clips after your review: nodaro edit continue-use-case ${result.jobId} --mode render-final [--edit <file>]`));
|
|
7265
|
+
} catch (err) {
|
|
7266
|
+
handleError(err);
|
|
7267
|
+
}
|
|
7268
|
+
}
|
|
7269
|
+
);
|
|
7270
|
+
const LAYOUT_FRAMING_SOURCES = Object.keys({ auto: true, static: true, tracking: true });
|
|
7271
|
+
withRecordingsOptions(
|
|
7272
|
+
cmd.command("speaker-layout").description("frame a whole recording by speaker in one step \u2014 the same length, nothing cut (several recordings: each speaker on their own camera)")
|
|
7273
|
+
).option("--aspect <aspect>", `the video's shape (default 9:16): ${EDL_TARGET_ASPECTS.join(" | ")}`).option("--layout <layout>", `how the speakers are laid out (default stacked): ${framingLayouts.join(" | ")}`).option("--switch <id>", "the switch at each speaker change (default cut): cut | pan | zoom | xfade:<transition>, e.g. xfade:fade").option("--emphasis <style>", `how the speaker talking is emphasised (default scale): ${EMPHASIS_HELP}`).option(
|
|
7274
|
+
"--framing-source <source>",
|
|
7275
|
+
`how the speakers are followed: ${LAYOUT_FRAMING_SOURCES.join(" | ")} (default auto: follows faces with Speaker Frames while it is available to you, else the even split; static: the even split; tracking: follows faces, charged per started block of 1,000 sampled frames)`
|
|
7276
|
+
).option("--review", "stop at a preview to review (render the final with `nodaro edit continue-use-case <jobId> --mode render-final`)").option("--idempotency-key <key>", "sent as Idempotency-Key: a retry with the same key answers the run already started").option("--watch", "poll the job until it finishes, then print the framed video's URL").option("--poll-interval <ms>", "poll interval with --watch", (v) => parseInt(v, 10)).option("--profile <name>").option("--json").action(
|
|
7277
|
+
async (opts) => {
|
|
7278
|
+
if (opts.aspect !== void 0 && !EDL_TARGET_ASPECTS.includes(opts.aspect)) {
|
|
7279
|
+
warn(`--aspect must be ${EDL_TARGET_ASPECTS.join(", ")} (got "${opts.aspect}")`);
|
|
7280
|
+
process.exit(1);
|
|
7281
|
+
}
|
|
7282
|
+
if (opts.layout !== void 0 && !framingLayouts.includes(opts.layout)) {
|
|
7283
|
+
warn(`--layout must be ${framingLayouts.join(", ")} (got "${opts.layout}")`);
|
|
7284
|
+
process.exit(1);
|
|
7285
|
+
}
|
|
7286
|
+
if (opts.switch !== void 0 && !SPEAKER_SWITCH_IDS.includes(opts.switch)) {
|
|
7287
|
+
warn(`--switch must be one of ${SPEAKER_SWITCH_IDS.join(", ")} (got "${opts.switch}")`);
|
|
7288
|
+
process.exit(1);
|
|
7289
|
+
}
|
|
7290
|
+
if (opts.emphasis !== void 0 && !isKnownSpeakerEmphasisStyle(opts.emphasis)) {
|
|
7291
|
+
warn(`--emphasis must be ${EMPHASIS_HELP} (got "${opts.emphasis}")`);
|
|
7292
|
+
process.exit(1);
|
|
7293
|
+
}
|
|
7294
|
+
if (opts.framingSource !== void 0 && !LAYOUT_FRAMING_SOURCES.includes(opts.framingSource)) {
|
|
7295
|
+
warn(`--framing-source must be ${LAYOUT_FRAMING_SOURCES.join(", ")} (got "${opts.framingSource}")`);
|
|
7296
|
+
process.exit(1);
|
|
7297
|
+
}
|
|
7298
|
+
const recordings = recordingsInput(opts);
|
|
7299
|
+
try {
|
|
7300
|
+
const client = buildClient(opts.profile);
|
|
7301
|
+
const result = await client.edit.speakerLayout(
|
|
7302
|
+
{
|
|
7303
|
+
...recordings,
|
|
7304
|
+
...opts.aspect ? { targetAspect: opts.aspect } : {},
|
|
7305
|
+
...opts.layout ? { layout: opts.layout } : {},
|
|
7306
|
+
...opts.switch ? { switchType: opts.switch } : {},
|
|
7307
|
+
...opts.emphasis ? { emphasisStyle: opts.emphasis } : {},
|
|
7308
|
+
...opts.framingSource ? { framingSource: opts.framingSource } : {},
|
|
7309
|
+
...opts.review ? { reviewBeforeRender: true } : {}
|
|
7310
|
+
},
|
|
7311
|
+
opts.idempotencyKey ? { idempotencyKey: opts.idempotencyKey } : void 0
|
|
7312
|
+
);
|
|
7313
|
+
const done = await reportQueuedJob(result, () => client.jobs.getStatus(result.jobId), {
|
|
7314
|
+
json: opts.json,
|
|
7315
|
+
watch: opts.watch,
|
|
7316
|
+
pollInterval: opts.pollInterval,
|
|
7317
|
+
note: "speaker-layout"
|
|
7318
|
+
});
|
|
7319
|
+
if (opts.json) return;
|
|
7320
|
+
const url = done?.data.output_data?.videoUrl;
|
|
7321
|
+
if (done?.data.status === "completed" && typeof url === "string") console.log(url);
|
|
7322
|
+
if (opts.review) console.log(pc5.dim(` render the final after your review: nodaro edit continue-use-case ${result.jobId} --mode render-final`));
|
|
7174
7323
|
} catch (err) {
|
|
7175
7324
|
handleError(err);
|
|
7176
7325
|
}
|
|
7177
7326
|
}
|
|
7178
7327
|
);
|
|
7179
|
-
cmd.command("continue-use-case <jobId>").description("continue a Tighten Episode, Chapters, Trailer
|
|
7328
|
+
cmd.command("continue-use-case <jobId>").description("continue a Tighten Episode, Chapters, Trailer, Clip Pack or Speaker Layout run as a new job: from where it failed, or its Render final after a review").requiredOption("--mode <mode>", "from-failed | render-final").option("--edit <file>", "render-final only: a JSON file holding the reviewer's edit of the plan (an EDL); a Speaker Layout run has no plan to edit").option(
|
|
7180
7329
|
"--type <type>",
|
|
7181
7330
|
`the run's node type (${USE_CASE_NODE_TYPES.join(" | ")}); without it the job is read for its type, which needs the jobs:read scope`
|
|
7182
7331
|
).option("--idempotency-key <key>", "sent as Idempotency-Key: a retry with the same key answers the run already started").option("--watch", "poll the job until it finishes").option("--poll-interval <ms>", "poll interval with --watch", (v) => parseInt(v, 10)).option("--profile <name>").option("--json").action(async (jobId, opts) => {
|
|
@@ -7214,9 +7363,9 @@ function registerUseCaseCommands(cmd) {
|
|
|
7214
7363
|
if (opts.json) {
|
|
7215
7364
|
emit({ error: { code: err.code, message: err.message }, jobId: err.jobId }, opts);
|
|
7216
7365
|
} else {
|
|
7217
|
-
console.error(
|
|
7218
|
-
console.error(
|
|
7219
|
-
console.error(
|
|
7366
|
+
console.error(pc5.red(`\u2717 ${err.message}`));
|
|
7367
|
+
console.error(pc5.dim(` code: ${err.code}`));
|
|
7368
|
+
console.error(pc5.dim(` job: ${err.jobId}${CONTINUATION_NEXT_STEP[err.code]?.(err.jobId) ?? ""}`));
|
|
7220
7369
|
}
|
|
7221
7370
|
process.exit(1);
|
|
7222
7371
|
}
|
|
@@ -7225,9 +7374,9 @@ function registerUseCaseCommands(cmd) {
|
|
|
7225
7374
|
if (opts.json) {
|
|
7226
7375
|
emit({ error: { code: err.code, message } }, opts);
|
|
7227
7376
|
} else {
|
|
7228
|
-
console.error(
|
|
7229
|
-
console.error(
|
|
7230
|
-
console.error(
|
|
7377
|
+
console.error(pc5.red(`\u2717 ${message}`));
|
|
7378
|
+
console.error(pc5.dim(` code: ${err.code}`));
|
|
7379
|
+
console.error(pc5.dim(` --type: ${USE_CASE_NODE_TYPES.join(" | ")}`));
|
|
7231
7380
|
}
|
|
7232
7381
|
process.exit(1);
|
|
7233
7382
|
}
|