mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-18 19:01:20 -08:00
chore: Update ArtPlayer version to 5.1.5
This commit is contained in:
1 parent
0fce9f5ffe
commit
a59942ca58
8 files changed
+61
-50
No files matched your search
@@ -65,30 +65,35 @@ export function assToVtt(ass) {
|
||||
.join('');
|
||||
}
|
||||
|
||||
return `WEBVTT\n\n${ass
|
||||
.split(/\r?\n/)
|
||||
.map((line) => {
|
||||
const m = line.match(reAss);
|
||||
if (!m) return null;
|
||||
return {
|
||||
start: fixTime(m[1].trim()),
|
||||
end: fixTime(m[2].trim()),
|
||||
text: m[5]
|
||||
.replace(/{[\s\S]*?}/g, '')
|
||||
.replace(/(\\N)/g, '\n')
|
||||
.trim()
|
||||
.split(/\r?\n/)
|
||||
.map((item) => item.trim())
|
||||
.join('\n'),
|
||||
};
|
||||
})
|
||||
.filter((line) => line)
|
||||
.map((line, index) => {
|
||||
if (line) {
|
||||
return `${index + 1}\n${line.start} --> ${line.end}\n${line.text}`;
|
||||
}
|
||||
return '';
|
||||
})
|
||||
.filter((line) => line.trim())
|
||||
.join('\n\n')}`;
|
||||
return (
|
||||
'WEBVTT' +
|
||||
'\n' +
|
||||
'\n' +
|
||||
ass
|
||||
.split(/\r?\n/)
|
||||
.map((line) => {
|
||||
const m = line.match(reAss);
|
||||
if (!m) return null;
|
||||
return {
|
||||
start: fixTime(m[1].trim()),
|
||||
end: fixTime(m[2].trim()),
|
||||
text: m[5]
|
||||
.replace(/{[\s\S]*?}/g, '')
|
||||
.replace(/(\\N)/g, '\n')
|
||||
.trim()
|
||||
.split(/\r?\n/)
|
||||
.map((item) => item.trim())
|
||||
.join('\n'),
|
||||
};
|
||||
})
|
||||
.filter((line) => line)
|
||||
.map((line, index) => {
|
||||
if (line) {
|
||||
return index + 1 + '\n' + `${line.start} --> ${line.end}` + '\n' + `${line.text}`;
|
||||
}
|
||||
return '';
|
||||
})
|
||||
.filter((line) => line.trim())
|
||||
.join('\n\n')
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user