File size: 1,096 Bytes
5443f48 |
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 |
import { ClapProject, ClapSegment, ClapSegmentCategory } from "@aitube/clap"
export function removeFinalVideos(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
}
*/
}
// we remove the final video from the full list of segments
const allCategoriesOfSegments = clap.segments.filter(s => s.id !== ignoreThisVideoSegmentId)
return allCategoriesOfSegments
} |