From b67ba124c7f7568021f847da368b877aa5575cd9 Mon Sep 17 00:00:00 2001 From: stratumadev Date: Mon, 6 Oct 2025 03:14:41 +0200 Subject: [PATCH] added more subtitle fixes for --- crunchy.ts | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/crunchy.ts b/crunchy.ts index 6bd546f..1bf8147 100644 --- a/crunchy.ts +++ b/crunchy.ts @@ -2753,9 +2753,6 @@ export default class Crunchy implements ServiceClass { break; } - // Removing CCC credits - sBody = sBody.replace('; Script generated by Closed Caption Converter | www.closedcaptionconverter.com\n', ''); - const lines = sBody.split('\n'); // Add PlayResX, PlayResY, Timer and WrapStyle @@ -2767,21 +2764,30 @@ export default class Crunchy implements ServiceClass { sBody = lines.join('\n'); } - if (!sBody.includes('www.closedcaptionconverter.com')) { + if (!options.noSubFix) { // LayoutRes Fix - if (options.layoutResFix && !options.noSubFix) { + if (options.layoutResFix && !sBody.includes('LayoutResX') && !sBody.includes('LayoutResY')) { sBody = sBody.replace(/^(PlayResY:\s*\d+)/m, `$1\nLayoutResX: ${playResX}\nLayoutResY: ${playResY}`); } // ScaleBorderAndShadow Fix - if (options.scaledBorderAndShadowFix && !options.noSubFix) { + if (options.scaledBorderAndShadowFix && !sBody.includes('ScaledBorderAndShadow')) { sBody = sBody.replace(/^(WrapStyle:.*)$/m, `$1\nScaledBorderAndShadow: ${options.scaledBorderAndShadow}`); } // Fix VLC wrong parsing if URL not avaiable - if (options.originalScriptFix && !options.noSubFix) { + if (options.originalScriptFix) { sBody = sBody.replace(/^Original Script:.*$/gm, 'Original Script: Crunchyroll'); } + + // Remove All Comments + sBody = sBody.replace(/^[ \t]*;.*\r?\n?/gm, ''); + + // Remove Aegisub Project Garbage + sBody = sBody.replace(/\[Aegisub Project Garbage\][\s\S]*?(?:\r?\n(?=\[)|$)/, ''); + + // Remove YCbCr + sBody = sBody.replace(/^[ \t]*YCbCr Matrix:\s*.*\r?\n?/m, ''); } sxData.title = langItem.language;