Added different fonts for Crunchyroll CCC fix

This commit is contained in:
stratumadev 2025-09-30 16:23:15 +02:00
parent 8546ba4a5d
commit 1f667b110f

View file

@ -2670,10 +2670,16 @@ export default class Crunchy implements ServiceClass {
// Fix invalid Dialogue and remove PlayDepth
sBody = sBody.replace(/,,,,25.00,,/g, ',,0,0,0,,').replace('PlayDepth: 0\n', '');
// Fix fonts (default crunchyroll german sub font)
sBody = sBody.replace(/^Style:\s*([^,]+),.*?,(\d+),0,0,0,0$/gm, (match, name, align) => {
return `Style: ${name},Arial,23,&H00FFFFFF,&H000000FF,&H00000000,&H00000000,-1,0,0,0,100,100,0,0,1,2,0,${align},0,0,20,1`;
});
// Fix fonts
if (langItem.language === 'German') {
sBody = sBody.replace(/^Style:\s*([^,]+),.*?,(\d+),0,0,0,0$/gm, (match, name, align) => {
return `Style: ${name},Arial,23,&H00FFFFFF,&H000000FF,&H00000000,&H00000000,-1,0,0,0,100,100,0,0,1,2,0,${align},0,0,20,1`;
});
} else {
sBody = sBody.replace(/^Style:\s*([^,]+),.*?,(\d+),0,0,0,0$/gm, (match, name, align) => {
return `Style: ${name},Trebuchet MS,24,&H00FFFFFF,&H000000FF,&H00000000,&H00000000,0,0,0,0,100,100,0,0,1,2,1,${align},0010,0010,0018,0`;
});
}
// Removing CCC credits
sBody = sBody.replace('; Script generated by Closed Caption Converter | www.closedcaptionconverter.com\n', '');
@ -2706,8 +2712,7 @@ export default class Crunchy implements ServiceClass {
}
}
sxData.title = sBody.split('\r\n')[1].replace(/^Title: /, '');
sxData.title = `${langItem.language} / ${sxData.title}`;
sxData.title = langItem.language;
sxData.fonts = fontsData.assFonts(sBody) as Font[];
}
fs.writeFileSync(sxData.path, sBody);