MCPcopy
hub / github.com/CapSoftware/Cap / normalizeProject

Function normalizeProject

apps/desktop/src/routes/editor/context.ts:203–261  ·  view source on GitHub ↗
(
	config: ProjectConfiguration,
)

Source from the content-addressed store, hash-verified

201}
202
203export function normalizeProject(
204 config: ProjectConfiguration,
205): EditorProjectConfiguration {
206 const keyboard =
207 config.keyboard && config.keyboard.settings.position === "above-captions"
208 ? {
209 ...config.keyboard,
210 settings: {
211 ...config.keyboard.settings,
212 position: "bottom-center",
213 },
214 }
215 : config.keyboard;
216
217 const timeline = config.timeline
218 ? {
219 ...config.timeline,
220 sceneSegments: config.timeline.sceneSegments ?? [],
221 captionSegments: config.timeline.captionSegments ?? [],
222 keyboardSegments: config.timeline.keyboardSegments ?? [],
223 maskSegments: normalizeTrackSegments(
224 (
225 config.timeline as TimelineConfiguration & {
226 maskSegments?: MaskSegment[];
227 }
228 ).maskSegments ?? [],
229 ),
230 textSegments: normalizeTrackSegments(
231 (
232 config.timeline as TimelineConfiguration & {
233 textSegments?: TextSegment[];
234 }
235 ).textSegments ?? [],
236 ),
237 audioSegments: normalizeTrackSegments(
238 (
239 config.timeline as TimelineConfiguration & {
240 audioSegments?: AudioTrackSegment[];
241 }
242 ).audioSegments ?? [],
243 ),
244 }
245 : undefined;
246 const captions = config.captions
247 ? {
248 ...config.captions,
249 settings: normalizeCaptionSettings(config.captions.settings),
250 }
251 : null;
252
253 return {
254 ...config,
255 keyboard,
256 timeline,
257 captions,
258 background: withCornerDefaults(config.background),
259 camera: withCornerDefaults(config.camera),
260 };

Callers 2

applyPresetFunction · 0.90
context.tsFile · 0.85

Calls 3

normalizeTrackSegmentsFunction · 0.90
normalizeCaptionSettingsFunction · 0.90
withCornerDefaultsFunction · 0.85

Tested by

no test coverage detected