mirror of
https://github.com/anidl/multi-downloader-nx.git
synced 2026-04-21 00:12:05 +00:00
Subtitle font size support
This commit is contained in:
parent
85341e9b91
commit
b2fb0e7260
3 changed files with 13 additions and 7 deletions
4
funi.js
4
funi.js
|
|
@ -395,7 +395,7 @@ function getSubsUrl(m){
|
|||
'esLA': 'Spanish (Latin Am)',
|
||||
'ptBR': 'Portuguese (Brazil)'
|
||||
};
|
||||
|
||||
|
||||
let subLangAvailable = m.some(a => {
|
||||
return a.ext == 'vtt' && a.language === subType[subLang]
|
||||
});
|
||||
|
|
@ -605,7 +605,7 @@ async function downloadStreams(){
|
|||
debug: argv.debug,
|
||||
});
|
||||
if(subsSrc.ok){
|
||||
let assData = vttConvert(subsSrc.res.body, (subsExt == '.srt' ? true : false), stDlPath.langName );
|
||||
let assData = vttConvert(subsSrc.res.body, (subsExt == '.srt' ? true : false), stDlPath.langName, argv.fontSize);
|
||||
subFile = path.join(cfg.dir.content, fnOutput) + stDlPath.ext + subsExt;
|
||||
subTrashFile = path.join(cfg.dir.trash, fnOutput) + stDlPath.ext + subsExt;
|
||||
fs.writeFileSync(subFile, assData);
|
||||
|
|
|
|||
|
|
@ -81,6 +81,12 @@ const appArgv = (cfg) => {
|
|||
choices: [ 'enUS', 'esLA', 'ptBR' ],
|
||||
type: 'string'
|
||||
})
|
||||
.option('fontSize', {
|
||||
group: 'Downloading:',
|
||||
describe: 'Used to set the fontsize of the subtitles',
|
||||
default: cfg.fontSize || 55,
|
||||
type: 'number'
|
||||
})
|
||||
// simulcast
|
||||
.option('simul', {
|
||||
group: 'Downloading:',
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ function loadVtt(vttStr) {
|
|||
}
|
||||
|
||||
// ass specific
|
||||
function convertToAss(vttStr, lang){
|
||||
function convertToAss(vttStr, lang, fontSize){
|
||||
let ass = [
|
||||
'\ufeff[Script Info]',
|
||||
`Title: ${lang}`,
|
||||
|
|
@ -49,8 +49,8 @@ function convertToAss(vttStr, lang){
|
|||
'Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, '
|
||||
+ 'Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, '
|
||||
+ 'BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding',
|
||||
'Style: Main,Noto Sans,55,&H00FFFFFF,&H000000FF,&H00020713,&H00000000,0,0,0,0,100,100,0,0,1,3,0,2,10,10,10,1',
|
||||
'Style: MainTop,Noto Sans,55,&H00FFFFFF,&H000000FF,&H00020713,&H00000000,0,0,0,0,100,100,0,0,1,3,0,8,10,10,10,1',
|
||||
`Style: Main,Noto Sans,${fontSize},&H00FFFFFF,&H000000FF,&H00020713,&H00000000,0,0,0,0,100,100,0,0,1,3,0,2,10,10,10,1`,
|
||||
`Style: MainTop,Noto Sans,${fontSize},&H00FFFFFF,&H000000FF,&H00020713,&H00000000,0,0,0,0,100,100,0,0,1,3,0,8,10,10,10`,
|
||||
'',
|
||||
'[Events]',
|
||||
'Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text',
|
||||
|
|
@ -160,7 +160,7 @@ function padTimeNum(sep, input, pad){
|
|||
}
|
||||
|
||||
// export module
|
||||
module.exports = (vttStr, toSrt, lang = 'English') => {
|
||||
module.exports = (vttStr, toSrt, lang = 'English', fontSize) => {
|
||||
const convert = toSrt ? convertToSrt : convertToAss;
|
||||
return convert(vttStr, lang);
|
||||
return convert(vttStr, lang, fontSize);
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue