VTT to ASS Fix new streams

it was added align:middle line:10% for the new streams, it will get converted to MainTop
tested with vivy ep 3(Old stream align:middle line:7%),E5,E6
&lt &amp &amp were not converted before eg, horimiya E9 08:55
This commit is contained in:
STRATOS99K 2021-05-02 15:25:09 -05:00 committed by GitHub
parent 1db5b763c4
commit c037fccac8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -70,31 +70,14 @@ function convertToAssLine(l, style) {
let end = convertTime(l.time_end);
let text = convertToAssText(l.text);
// debugger
if (l.ext_param.align != 'middle') {
console.log('[WARN] Detected specific align param, please contact developer');
cosnole.log(l);
}
if (l.ext_param.vertical) {
console.log('[WARN] Detected specific vertical param, please contact developer');
cosnole.log(l);
}
if (l.ext_param.line && l.ext_param.line != '7%') {
console.log('[WARN] Detected specific line param, please contact developer');
cosnole.log(l);
}
if (l.ext_param.position) {
console.log('[WARN] Detected specific position param, please contact developer');
cosnole.log(l);
}
if (l.text.match(/<font/)){
console.log('[WARN] Detected specific color param, please contact developer');
cosnole.log(l);
}
// debugger
if (l.ext_param.line === '7%') {
style = 'MainTop';
}
if (l.ext_param.line === '10%') {
style = 'MainTop';
}
return `Dialogue: 0,${start},${end},${style},,0,0,0,,${text}`;
}
@ -109,8 +92,9 @@ function convertToAssText(text) {
.replace(/<b[^>]*>([^<]*)<\/b>/g, '{\\b1}$1{\\b0}')
.replace(/<i[^>]*>([^<]*)<\/i>/g, '{\\i1}$1{\\i0}')
.replace(/<u[^>]*>([^<]*)<\/u>/g, '{\\u1}$1{\\u0}')
// .replace(/<c[^>]*>[^<]*<\/c>/g, '')
// .replace(/<ruby[^>]*>[^<]*<\/ruby>/g, '')
.replace(/&lt;/g, '<')
.replace(/&gt;/g, '>')
.replace(/&amp;/g, '&')
.replace(/<[^>]>/g, '')
.replace(/\\N$/, '')
.replace(/ +$/, '');