diff --git a/src/utils/exporter.ts b/src/utils/exporter.ts index 7d3f5ee2..ec67133b 100644 --- a/src/utils/exporter.ts +++ b/src/utils/exporter.ts @@ -39,7 +39,8 @@ export function importTimes(data: string, videoDuration: number): SponsorTime[] if (match) { const startTime = GenericUtils.getFormattedTimeToSeconds(match[0]); if (startTime !== null) { - const specialCharsMatcher = /^(?:\s+seconds?)?[-:()\s]*|(?:\s+at)?[-:()\s]+$/g + // Remove "seconds", "at", special characters, and ")" if there was a "(" + const specialCharsMatcher = /^(?:\s+seconds?)?[-:()\s]*|(?:\s+at)?[-:(\s]+$|(?<=^\s*\(.+)[-:()\s]*$/g const titleLeft = line.split(match[0])[0].replace(specialCharsMatcher, ""); let titleRight = null; const split2 = line.split(match[1] || match[0]); diff --git a/test/exporter.test.ts b/test/exporter.test.ts index a3af0c04..bf948df0 100644 --- a/test/exporter.test.ts +++ b/test/exporter.test.ts @@ -275,4 +275,20 @@ describe("Import segments", () => { category: "chapter" as Category }]); }); + + it ("0:00 G¹ (Tangent Continuity)", () => { + const input = ` 0:00 G¹ (Tangent Continuity) + 0:01 G² (Tangent Continuity)`; + + const result = importTimes(input, 8000); + expect(result).toMatchObject([{ + segment: [0, 1], + description: "G¹ (Tangent Continuity)", + category: "chapter" as Category + }, { + segment: [1, 8000], + description: "G² (Tangent Continuity)", + category: "chapter" as Category + }]); + }); }); \ No newline at end of file