Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion skills-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"files": 10
},
"media-use": {
"hash": "e3f818afb0afbb34",
"hash": "2b235d475759716a",
"files": 122
},
"motion-graphics": {
Expand Down
7 changes: 5 additions & 2 deletions skills/media-use/scripts/resolve.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import { findGlobalBySha } from "./lib/cache.mjs";
import { heygenAuthMethod } from "../audio/scripts/lib/heygen.mjs";
import { buildCube, paramsFromIntent } from "./lib/cube-build.mjs";
import { validateCubeFile } from "./lib/cube-validate.mjs";

const INGEST_TYPES = [...listTypes(), "video"];
import { analyzeMediaGrade, formatMeasuredNote } from "./lib/grade-analyzer.mjs";
import {
freezeLibraryLut,
Expand Down Expand Up @@ -720,8 +722,8 @@ async function resolveColor(type, intent, options) {
}

async function ingest(src) {
if (!type || !listTypes().includes(type)) {
console.error(`error: --from requires --type (one of: ${listTypes().join(", ")})`);
if (!type || !INGEST_TYPES.includes(type)) {
console.error(`error: --from requires --type (one of: ${INGEST_TYPES.join(", ")})`);
process.exit(2);
}
const isUrl = /^https?:\/\//i.test(src);
Expand Down Expand Up @@ -1135,6 +1137,7 @@ const DEFAULT_EXT = {
icon: ".svg",
logo: ".svg",
brand: ".png",
video: ".mp4",
grade: ".cube",
lut: ".cube",
};
Expand Down
14 changes: 14 additions & 0 deletions skills/media-use/scripts/resolve.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,20 @@ test("--help exits 0", () => {
assert.ok(out.includes("--stats"));
});

test("--from registers a derived video as documented", () => {
setup();
const source = join(tmp, "derived.mp4");
writeFileSync(source, "derived video bytes");

const out = runResolve(["--from", source, "--type", "video", "--project", tmp, "--json"]);
const parsed = JSON.parse(out.trim());
assert.equal(parsed.ok, true);
assert.equal(parsed.type, "video");
assert.match(parsed.path, /^\.media\/video\/video_001\.mp4$/);
assert.equal(readManifest(tmp)[0]?.type, "video");
cleanup();
});

test("unknown type error lists grade and lut", () => {
try {
runResolve(["--type", "bogus", "--intent", "x"], { stdio: "pipe" });
Expand Down
Loading