Import public videos from jmartgraphix as Video (and 3D Animation when relevant), with player embeds, thumbnails, and dashboard UI.
39 lines
1.1 KiB
TypeScript
39 lines
1.1 KiB
TypeScript
/**
|
|
* Vimeo profile video importer CLI.
|
|
*
|
|
* npm run import:vimeo -- --user jmartgraphix
|
|
* npm run import:vimeo -- --user jmartgraphix --publish
|
|
* npm run import:vimeo -- --user jmartgraphix --dry-run
|
|
*/
|
|
import "dotenv/config";
|
|
import { runVimeoImport } from "../src/services/vimeo-import.js";
|
|
import { prisma } from "../src/lib/prisma.js";
|
|
|
|
function arg(name: string, fallback?: string): string | undefined {
|
|
const idx = process.argv.indexOf(`--${name}`);
|
|
if (idx >= 0 && process.argv[idx + 1]) return process.argv[idx + 1];
|
|
return fallback;
|
|
}
|
|
|
|
function hasFlag(name: string): boolean {
|
|
return process.argv.includes(`--${name}`);
|
|
}
|
|
|
|
async function main() {
|
|
const result = await runVimeoImport({
|
|
username: arg("user", "jmartgraphix"),
|
|
dryRun: hasFlag("dry-run"),
|
|
publish: hasFlag("publish"),
|
|
});
|
|
console.log(
|
|
`Summary: found=${result.found} imported=${result.imported} skipped=${result.skipped} errors=${result.errors}`
|
|
);
|
|
}
|
|
|
|
main()
|
|
.catch((e) => {
|
|
console.error(e);
|
|
process.exit(1);
|
|
})
|
|
.finally(() => prisma.$disconnect());
|