Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
File size: 1,111 Bytes
7fca805 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
import { ClapProject, ClapSegment, ClapSegmentCategory } from "@aitube/clap"
export function videoChunksOnly(clap: ClapProject): ClapSegment[] {
const alreadyAnEmbeddedFinalVideo = clap.segments.filter(s =>
s.category === ClapSegmentCategory.VIDEO &&
s.status === "completed" &&
s.startTimeInMs === 0 &&
s.endTimeInMs === clap.meta.durationInMs &&
s.assetUrl).at(0)
let ignoreThisVideoSegmentId = ""
if (alreadyAnEmbeddedFinalVideo) {
ignoreThisVideoSegmentId = alreadyAnEmbeddedFinalVideo?.id || ""
/*
you know what.. let's just ignore it, and re-generate fresh content
because most probably the user made an honest mistake
const outputFilePath = await writeBase64ToFile(
alreadyAnEmbeddedFinalVideo.assetUrl,
join(outputDir, `existing_final_video`)
)
return {
tmpWorkDir: outputDir,
outputFilePath
}
*/
}
const videoSegments = clap.segments.filter(s =>
s.category === ClapSegmentCategory.VIDEO &&
s.assetUrl.startsWith("data:video/") &&
s.id !== ignoreThisVideoSegmentId
)
return videoSegments
} |