From 1a389a067ae6c279b1f68839063a3f1117eb0a1d Mon Sep 17 00:00:00 2001 From: Daniel Haller Date: Thu, 25 Apr 2024 23:42:48 +0200 Subject: [PATCH] fixed adn subtitle parser --- src/api/services/subs.ts | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/src/api/services/subs.ts b/src/api/services/subs.ts index 6eac289..0de7a4e 100644 --- a/src/api/services/subs.ts +++ b/src/api/services/subs.ts @@ -195,10 +195,34 @@ Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text\ lineAlign: string text: string }> + vostf: Array<{ + startTime: number + endTime: number + positionAligh: string + lineAlign: string + text: string + }> + vf: Array<{ + startTime: number + endTime: number + positionAligh: string + lineAlign: string + text: string + }> } = await JSON.parse(subs) - if (parsedSubs.vde) { - for (const s of parsedSubs.vde) { + // if (parsedSubs.vde) { + // for (const s of parsedSubs.vde) { + // const convertedStart = convertToTimeFormat(s.startTime) + // const convertedEnd = convertToTimeFormat(s.endTime) + + // templateASS = + // templateASS + `Dialogue: 0,${convertedStart},${convertedEnd},Default,,0,0,0,,${s.text.replace('\n', '\\N').replace('', '{\\i1}').replace('', '{\\i0}')}\n` + // } + // } + + if (parsedSubs.vostde) { + for (const s of parsedSubs.vostde) { const convertedStart = convertToTimeFormat(s.startTime) const convertedEnd = convertToTimeFormat(s.endTime) @@ -207,7 +231,7 @@ Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text\ } } - if (parsedSubs.vostde) { + if (parsedSubs.vostf) { for (const s of parsedSubs.vostde) { const convertedStart = convertToTimeFormat(s.startTime) const convertedEnd = convertToTimeFormat(s.endTime)