- 引入 manifest.json 作为唯一状态源,所有子 Agent 操作回写 manifest - 重构 timebuilder 逻辑,支持四种视频适配策略(加速/裁剪/放缓/画面停顿) - 统一 TTS 阶段输出结构,单句和多句均写入 segments[] - 重写字幕和配音生成,基于 segments 精确时长实现音画同步 - 新增 confirm 命令支持按 id 范围确认,上传阶段分离图片和视频 - 添加中间产物写入 output/ 目录的约束,清理废弃配置参数
43 lines
1.3 KiB
JavaScript
43 lines
1.3 KiB
JavaScript
/**
|
||
* Command: confirm — 人工确认分镜图
|
||
*/
|
||
|
||
const { loadManifest, saveManifest } = require('./pipeline-utils')
|
||
|
||
function confirmManifest(options) {
|
||
const { manifest: manifestPath, all, items: itemsStr } = options
|
||
|
||
if (!manifestPath) {
|
||
console.error('用法: pipeline.js confirm --manifest <path> --all')
|
||
console.error(' pipeline.js confirm --manifest <path> --items 1,3,5')
|
||
process.exit(1)
|
||
}
|
||
if (!all && !itemsStr) {
|
||
console.error('错误: 必须指定 --all 或 --items <id列表>')
|
||
process.exit(1)
|
||
}
|
||
|
||
const manifest = loadManifest(manifestPath)
|
||
const targetIds = itemsStr
|
||
? new Set(itemsStr.split(',').map(s => parseInt(s.trim(), 10)).filter(n => !isNaN(n)))
|
||
: null
|
||
|
||
let count = 0
|
||
for (const item of manifest.items) {
|
||
if (targetIds && !targetIds.has(item.id)) continue
|
||
if (item.file && item.status === 'done' && !item.confirmed) {
|
||
item.confirmed = true
|
||
count++
|
||
}
|
||
}
|
||
|
||
saveManifest(manifestPath, manifest)
|
||
|
||
const total = manifest.items.length
|
||
const confirmed = manifest.items.filter(it => it.confirmed).length
|
||
const scope = targetIds ? `${Array.from(targetIds).join(',')}` : '全部'
|
||
console.log(`已确认: ${count} items(范围: ${scope},共 ${confirmed}/${total} 已确认)`)
|
||
}
|
||
|
||
module.exports = { confirmManifest }
|