[HD] Fix fontsize for vtt2ass for new API

This commit is contained in:
AnimeDL 2024-03-16 22:26:56 -07:00
parent 34fa052bc2
commit 48d8a276d7
2 changed files with 6 additions and 2 deletions

View file

@ -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 {

View file

@ -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`;
}