From 48d8a276d7f753c55a91244a046ccca3831bd818 Mon Sep 17 00:00:00 2001 From: AnimeDL Date: Sat, 16 Mar 2024 22:26:56 -0700 Subject: [PATCH] [HD] Fix fontsize for vtt2ass for new API --- hidive.ts | 6 +++++- modules/module.vtt2ass.ts | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/hidive.ts b/hidive.ts index 13583e2..713f36a 100644 --- a/hidive.ts +++ b/hidive.ts @@ -1031,7 +1031,7 @@ export default class Hidive implements ServiceClass { const variables: Variable[] = []; let dlFailed = false; const subsMargin = 0; - const chosenFontSize = options.fontSize; + const chosenFontSize = options.originalFontSize ? undefined : options.fontSize; let encryptionKeys: KeyContainer[] | undefined = undefined; if (!canDecrypt) console.warn('Decryption not enabled!'); @@ -1322,6 +1322,10 @@ export default class Hidive implements ServiceClass { const cssGroups = getVttContent.res.body.matchAll(/::cue(?:.(.+)\))?{([^}]+)}/g); let defaultCss = ''; for (const cssGroup of cssGroups) { + //Below code will bulldoze defined sizes for custom ones + /*if (!options.originalFontSize) { + cssGroup[2] = cssGroup[2].replace(/( font-size:.+?;)/g, '').replace(/(font-size:.+?;)/g, ''); + }*/ if (cssGroup[1]) { cssLines.push(`${cssGroup[1]}{${defaultCss}${cssGroup[2]}}`); } else { diff --git a/modules/module.vtt2ass.ts b/modules/module.vtt2ass.ts index 86b24f1..648b539 100644 --- a/modules/module.vtt2ass.ts +++ b/modules/module.vtt2ass.ts @@ -69,7 +69,7 @@ function loadCSS(cssStr: string): Css { function parseStyle(stylegroup: string, line: string, style: any) { const defaultSFont = rFont == '' ? defaultStyleFont : rFont; //redeclare cause of let - if (stylegroup.startsWith('Subtitle') || stylegroup.startsWith('Song')) { //base for dialog, everything else use defaultStyle + if (stylegroup.startsWith('Subtitle') || stylegroup.startsWith('Song') || stylegroup.startsWith('Q')) { //base for dialog, everything else use defaultStyle style = `${defaultSFont},${fontSize},&H00FFFFFF,&H000000FF,&H00000000,&H00000000,0,0,0,0,100,100,0,0,1,2.6,0,2,20,20,46,1`; }