mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-14 15:37:12 +03:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f764869cc8 | ||
|
|
2ba5fa6954 | ||
|
|
35b8a34162 | ||
|
|
3379189ea8 | ||
|
|
e6be13b583 |
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "__MSG_fullName__",
|
"name": "__MSG_fullName__",
|
||||||
"short_name": "SponsorBlock",
|
"short_name": "SponsorBlock",
|
||||||
"version": "5.1.9",
|
"version": "5.1.10",
|
||||||
"default_locale": "en",
|
"default_locale": "en",
|
||||||
"description": "__MSG_Description__",
|
"description": "__MSG_Description__",
|
||||||
"homepage_url": "https://sponsor.ajay.app",
|
"homepage_url": "https://sponsor.ajay.app",
|
||||||
|
|||||||
@@ -942,7 +942,7 @@
|
|||||||
"message": "Hide forever"
|
"message": "Hide forever"
|
||||||
},
|
},
|
||||||
"warningChatInfo": {
|
"warningChatInfo": {
|
||||||
"message": "We noticed you were making some common mistakes that are not malicious"
|
"message": "We noticed you were making some common mistakes. We very much appreciate your work so far, but we strive towards perfection here, so even very small mistakes matter :)"
|
||||||
},
|
},
|
||||||
"warningTitle": {
|
"warningTitle": {
|
||||||
"message": "You got a warning"
|
"message": "You got a warning"
|
||||||
|
|||||||
@@ -39,7 +39,8 @@ export function importTimes(data: string, videoDuration: number): SponsorTime[]
|
|||||||
if (match) {
|
if (match) {
|
||||||
const startTime = GenericUtils.getFormattedTimeToSeconds(match[0]);
|
const startTime = GenericUtils.getFormattedTimeToSeconds(match[0]);
|
||||||
if (startTime !== null) {
|
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, "");
|
const titleLeft = line.split(match[0])[0].replace(specialCharsMatcher, "");
|
||||||
let titleRight = null;
|
let titleRight = null;
|
||||||
const split2 = line.split(match[1] || match[0]);
|
const split2 = line.split(match[1] || match[0]);
|
||||||
|
|||||||
@@ -275,4 +275,36 @@ describe("Import segments", () => {
|
|||||||
category: "chapter" as Category
|
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
|
||||||
|
}]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it ("((Some name) 1:20)", () => {
|
||||||
|
const input = ` ((Some name) 1:20)
|
||||||
|
((Some other name) 1:25)`;
|
||||||
|
|
||||||
|
const result = importTimes(input, 8000);
|
||||||
|
expect(result).toMatchObject([{
|
||||||
|
segment: [80, 85],
|
||||||
|
description: "Some name",
|
||||||
|
category: "chapter" as Category
|
||||||
|
}, {
|
||||||
|
segment: [85, 8000],
|
||||||
|
description: "Some other name",
|
||||||
|
category: "chapter" as Category
|
||||||
|
}]);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
Reference in New Issue
Block a user