add flag --originalFontSize

Flag to keep original font size for the service Hidive (which defines it's own expected fontsize per series)
This commit is contained in:
AnimeDL 2023-07-07 15:43:11 -07:00
parent 4eb3a4a916
commit 371b8336f1
3 changed files with 17 additions and 4 deletions

View file

@ -416,7 +416,7 @@ export default class Hidive implements ServiceClass {
console.info(`[INFO] Selected dub(s): ${options.dubLang.join(', ')}`);
const videoUrls = videoData.Data.VideoUrls;
const subsUrls = videoData.Data.CaptionVttUrls;
const fontSize = videoData.Data.FontSize ? videoData.Data.FontSize : 34;
const fontSize = videoData.Data.FontSize ? videoData.Data.FontSize : options.fontSize;
const subsSel = subsList;
//Get Selected Video URLs
const videoSel = videoList.sort().filter(videoLanguage =>
@ -490,10 +490,11 @@ export default class Hidive implements ServiceClass {
let mediaName = '...';
let fileName;
const files: DownloadedMedia[] = [];
const variables: Variable[] = [];
let dlFailed = false;
//let dlVideoOnce = false; // Variable to save if best selected video quality was downloaded
let subsMargin = 0;
const variables: Variable[] = [];
const chosenFontSize = options.originalFontSize ? fontSize : options.fontSize;
for (const videoData of videoUrls) {
if(videoData.seriesTitle && videoData.episodeNumber && videoData.episodeTitle){
mediaName = `${videoData.seriesTitle} - ${videoData.episodeNumber} - ${videoData.episodeTitle}`;
@ -700,8 +701,7 @@ export default class Hidive implements ServiceClass {
const getVttContent = await this.req.getData(await this.genSubsUrl('vtt', subsXUrl));
if (getCssContent.ok && getVttContent.ok && getCssContent.res && getVttContent.res) {
//vttConvert(getVttContent.res.body, false, subLang.name, fontSize);
//TODO: look into potentially having an option for native fontSize
const sBody = vtt(undefined, options.fontSize, getVttContent.res.body, getCssContent.res.body, subsMargin, options.fontName);
const sBody = vtt(undefined, chosenFontSize, getVttContent.res.body, getCssContent.res.body, subsMargin, options.fontName);
sxData.title = `${subLang.language} / ${sxData.title}`;
sxData.fonts = fontsData.assFonts(sBody) as Font[];
fs.writeFileSync(sxData.path, sBody);

View file

@ -63,6 +63,7 @@ let argvC: {
$0: string;
dlVideoOnce: boolean;
removeBumpers: boolean;
originalFontSize: boolean;
};
export type ArgvType = typeof argvC;

View file

@ -205,6 +205,18 @@ const args: TAppArg<boolean|number|string|unknown[]>[] = [
default: true
}
},
{
name: 'originalFontSize',
describe: 'Keep original font size',
type: 'boolean',
group: 'dl',
service: ['hidive'],
docDescribe: 'If selected, it will prefer to keep the original Font Size defined by the service.',
usage: '',
default: {
default: true
}
},
{
name: 'x',
group: 'dl',