From 2823e51b1d929464615a309b067ef60f9588d6ad Mon Sep 17 00:00:00 2001 From: Ajay Date: Tue, 11 Feb 2025 20:28:10 -0500 Subject: [PATCH 1/5] Allow importing placeholder chapters without start times --- src/content.ts | 3 ++- src/utils/exporter.ts | 17 ++++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/content.ts b/src/content.ts index 0eb01389..58e94f38 100644 --- a/src/content.ts +++ b/src/content.ts @@ -306,7 +306,8 @@ function messageListener(request: Message, sender: unknown, sendResponse: (respo for (const segment of importedSegments) { if (!sponsorTimesSubmitting.some( (s) => Math.abs(s.segment[0] - segment.segment[0]) < 1 - && Math.abs(s.segment[1] - segment.segment[1]) < 1)) { + && Math.abs(s.segment[1] - segment.segment[1]) < 1 + && s.description === segment.description)) { const hasChaptersPermission = (Config.config.showCategoryWithoutPermission || Config.config.permissions["chapter"]); if (segment.category === "chapter" && (!utils.getCategorySelection("chapter") || !hasChaptersPermission)) { diff --git a/src/utils/exporter.ts b/src/utils/exporter.ts index 85e1b383..c3f2ee2d 100644 --- a/src/utils/exporter.ts +++ b/src/utils/exporter.ts @@ -34,9 +34,12 @@ function exportTime(segment: SponsorTime): string { export function importTimes(data: string, videoDuration: number): SponsorTime[] { const lines = data.split("\n"); + const timeRegex = /(?:((?:\d+:)?\d+:\d+)+(?:\.\d+)?)|(?:\d+(?=s| second))/g; + const anyLineHasTime = lines.some((line) => timeRegex.test(line)); + const result: SponsorTime[] = []; for (const line of lines) { - const match = line.match(/(?:((?:\d+:)?\d+:\d+)+(?:\.\d+)?)|(?:\d+(?=s| second))/g); + const match = line.match(timeRegex); if (match) { const startTime = getFormattedTimeToSeconds(match[0]); if (startTime !== null) { @@ -71,6 +74,18 @@ export function importTimes(data: string, videoDuration: number): SponsorTime[] result.push(segment); } + } else if (!anyLineHasTime) { + // Adding chapters with placeholder times + const segment: SponsorTime = { + segment: [0, 0], + category: "chapter" as Category, + actionType: ActionType.Chapter, + description: line, + source: SponsorSourceType.Local, + UUID: generateUserID() as SegmentUUID + }; + + result.push(segment); } } From 6a4bb50006090974daed2f674ae3baac260db480 Mon Sep 17 00:00:00 2001 From: Ajay Date: Sun, 2 Mar 2025 23:34:50 -0500 Subject: [PATCH 2/5] Fix document script player client fetching --- maze-utils | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maze-utils b/maze-utils index 67799eeb..de2cda1e 160000 --- a/maze-utils +++ b/maze-utils @@ -1 +1 @@ -Subproject commit 67799eebf03238a999e24de1ce9bddcb919b7c99 +Subproject commit de2cda1e75eb88560dd94546197b674e7f044788 From 3174eda29a2db2f2dd136e4edde39e738fd986c7 Mon Sep 17 00:00:00 2001 From: Ajay Date: Sun, 2 Mar 2025 23:40:30 -0500 Subject: [PATCH 3/5] bump version --- manifest/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest/manifest.json b/manifest/manifest.json index aea11c66..e1c2c6f1 100644 --- a/manifest/manifest.json +++ b/manifest/manifest.json @@ -1,7 +1,7 @@ { "name": "__MSG_fullName__", "short_name": "SponsorBlock", - "version": "5.11.5", + "version": "5.11.6", "default_locale": "en", "description": "__MSG_Description__", "homepage_url": "https://sponsor.ajay.app", From be98dc7b73ed3e07e3cd2510895b849e27f0e2bd Mon Sep 17 00:00:00 2001 From: Ajay Date: Sun, 2 Mar 2025 23:41:58 -0500 Subject: [PATCH 4/5] update translations --- public/_locales | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/_locales b/public/_locales index a45cc387..464b48c2 160000 --- a/public/_locales +++ b/public/_locales @@ -1 +1 @@ -Subproject commit a45cc387cad0172de63bc1e25fb6f5c1c6ac2c69 +Subproject commit 464b48c2f0485b10e7c32fd599e650ab817c6402 From 9ef948670c5efa3b2caced0570a70dfbf8b346fb Mon Sep 17 00:00:00 2001 From: Ajay Date: Tue, 4 Mar 2025 21:08:39 -0500 Subject: [PATCH 5/5] bump version --- manifest/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest/manifest.json b/manifest/manifest.json index e1c2c6f1..62889abb 100644 --- a/manifest/manifest.json +++ b/manifest/manifest.json @@ -1,7 +1,7 @@ { "name": "__MSG_fullName__", "short_name": "SponsorBlock", - "version": "5.11.6", + "version": "5.11.7", "default_locale": "en", "description": "__MSG_Description__", "homepage_url": "https://sponsor.ajay.app",