diff --git a/materialious/src/lib/components/Transcript.svelte b/materialious/src/lib/components/Transcript.svelte index 816605c0..27dd1870 100644 --- a/materialious/src/lib/components/Transcript.svelte +++ b/materialious/src/lib/components/Transcript.svelte @@ -7,6 +7,7 @@ import type { VideoPlay } from '../api/model'; import { decodeHtmlCharCodes } from '../misc'; import { instanceStore } from '../store'; + import { SvelteSet } from 'svelte/reactivity'; interface Props { video: VideoPlay; @@ -52,29 +53,7 @@ `${!video.fallbackPatch ? new URL(get(instanceStore)).origin : ''}${url}` ); transcript = await parseText(await resp.text(), { strict: false }); - - // Group cues by Math.ceil(startTime) - // eslint-disable-next-line svelte/prefer-svelte-reactivity - const startTimeMap = new Map(); - for (const cue of transcript.cues) { - const roundedTime = Math.ceil(cue.startTime); - if (!startTimeMap.has(roundedTime)) { - startTimeMap.set(roundedTime, []); - } - startTimeMap.get(roundedTime)!.push(cue); - } - - // Keep only the second cue if multiple exist for the same rounded time - transcriptCues = []; - for (const [, cues] of startTimeMap.entries()) { - if (cues.length === 1) { - transcriptCues.push(cues[0]); - } else if (cues.length >= 2) { - transcriptCues.push(cues[1]); // Keep the second one - } - } - - transcript.cues = transcriptCues; + transcriptCues = transcript.cues; isLoading = false; } @@ -95,8 +74,8 @@ } -
-
+
+
{$_('transcript')}