|
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 || "" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
const allCategoriesOfSegments = clap.segments.filter(s => s.id !== ignoreThisVideoSegmentId) |
|
|
|
return allCategoriesOfSegments |
|
} |