@sub37/webvtt-adapter 2.2.0 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Adapter.js +1 -1
- package/lib/Parser/Timestamps.utils.js +1 -1
- package/package.json +2 -2
package/lib/Adapter.js
CHANGED
|
@@ -7,7 +7,7 @@ import { parseMs } from "./Parser/Timestamps.utils.js";
|
|
|
7
7
|
const WEBVTT_HEADER_SECTION = /^(?:[\uFEFF\n\s]*)?WEBVTT/;
|
|
8
8
|
const X_TIMESTAMP_MAP_REGEX = /^X-TIMESTAMP-MAP=([^,\r\n]*),\s*([^,\r\n]*)/;
|
|
9
9
|
const BLOCK_MATCH_REGEX = /(?<blocktype>(?:REGION|STYLE|NOTE))[\s\r\n]*(?<payload>[\w\W]*)/;
|
|
10
|
-
const CUE_MATCH_REGEX = /(?:(?<cueid>[^\n\t]*)\s+)?(?<starttime>(?:(?:\d
|
|
10
|
+
const CUE_MATCH_REGEX = /(?:(?<cueid>[^\n\t]*)\s+)?(?<starttime>(?:(?:\d{2,}:)?(?:\d\d:)(?:\d\d)\.\d{3}))[\x20\t]+-->[\x20\t]+(?<endtime>(?:(?:\d{2,}:)?(?:\d\d:)(?:\d\d)\.\d{3}))\s*?(?:(?<attributes>[^\r\n]*?)\s*)[\r\n]+\s*(?<text>(?:.+\s*)+)/;
|
|
11
11
|
const TABS_REGEX = /\t+/g;
|
|
12
12
|
/**
|
|
13
13
|
* @see https://www.w3.org/TR/webvtt1/#file-structure
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const TIME_REGEX = /(?<hours>(\d{2})?
|
|
1
|
+
const TIME_REGEX = /(?:(?<hours>(\d{2,})):)?(?<minutes>(\d{2})):(?<seconds>(\d{2}))(?:\.(?<milliseconds>(\d{0,3})))?/;
|
|
2
2
|
export function parseMs(timestring) {
|
|
3
3
|
const timeMatch = timestring.match(TIME_REGEX);
|
|
4
4
|
if (!timeMatch?.groups) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sub37/webvtt-adapter",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.1",
|
|
4
4
|
"description": "A subtitles adapter for WebVTT subtitles",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -28,5 +28,5 @@
|
|
|
28
28
|
"files": [
|
|
29
29
|
"lib/**/*.+(js|d.ts)!(*.map)"
|
|
30
30
|
],
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "83f384ce7950019ee32c91adf2e388271ab6a323"
|
|
32
32
|
}
|