feat(video-pipeline): 重构视频流水线,优化成片时间线规则和状态管理
- 引入 manifest.json 作为唯一状态源,所有子 Agent 操作回写 manifest - 重构 timebuilder 逻辑,支持四种视频适配策略(加速/裁剪/放缓/画面停顿) - 统一 TTS 阶段输出结构,单句和多句均写入 segments[] - 重写字幕和配音生成,基于 segments 精确时长实现音画同步 - 新增 confirm 命令支持按 id 范围确认,上传阶段分离图片和视频 - 添加中间产物写入 output/ 目录的约束,清理废弃配置参数
This commit is contained in:
@@ -5,21 +5,26 @@
|
||||
const { loadManifest, saveManifest } = require('./pipeline-utils')
|
||||
|
||||
function confirmManifest(options) {
|
||||
const { manifest: manifestPath, all } = 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) {
|
||||
console.error('错误: 必须指定 --all')
|
||||
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++
|
||||
@@ -30,7 +35,8 @@ function confirmManifest(options) {
|
||||
|
||||
const total = manifest.items.length
|
||||
const confirmed = manifest.items.filter(it => it.confirmed).length
|
||||
console.log(`已确认: ${count} items(共 ${confirmed}/${total} 已确认)`)
|
||||
const scope = targetIds ? `${Array.from(targetIds).join(',')}` : '全部'
|
||||
console.log(`已确认: ${count} items(范围: ${scope},共 ${confirmed}/${total} 已确认)`)
|
||||
}
|
||||
|
||||
module.exports = { confirmManifest }
|
||||
|
||||
Reference in New Issue
Block a user