This commit is contained in:
Izuco 2022-05-29 16:18:15 +02:00
parent 86728d08b9
commit 11372c041f
No known key found for this signature in database
GPG key ID: E9CBE9E4EF3A1BFA
7 changed files with 54 additions and 15 deletions

View file

@ -20,7 +20,9 @@ export type CrunchyDownloadOptions = {
mp4: boolean,
override: string[],
videoTitle: string,
force: 'Y'|'y'|'N'|'n'|'C'|'c'
force: 'Y'|'y'|'N'|'n'|'C'|'c',
ffmpegOptions: string[],
mkvmergeOptions: string[]
}
export type CurnchyMultiDownload = {
@ -37,7 +39,9 @@ export type CrunchyMuxOptions = {
mp4: boolean,
forceMuxer?: 'ffmpeg'|'mkvmerge',
nocleanup?: boolean,
videoTitle: string
videoTitle: string,
ffmpegOptions: string[],
mkvmergeOptions: string[]
}
export type CrunchyEpMeta = {

View file

@ -92,7 +92,8 @@ export type FuniGetShowData = { id: number, e?: string, but: boolean, all: boole
export type FuniGetEpisodeData = { subs: FuniSubsData, fnSlug: FuniEpisodeData, simul?: boolean; dubLang: string[], s: string }
export type FuniStreamData = { force?: 'Y'|'y'|'N'|'n'|'C'|'c', callbackMaker?: (data: DownloadInfo) => HLSCallback, q: number, x: number, fileName: string, numbers: number, novids?: boolean,
timeout: number, partsize: number, fsRetryTime: number, noaudio?: boolean, mp4: boolean, ass: boolean, fontSize: number, fontName?: string, skipmux?: boolean,
forceMuxer: AvailableMuxer | undefined, simul: boolean, skipSubMux: boolean, nocleanup: boolean, override: string[], videoTitle: string }
forceMuxer: AvailableMuxer | undefined, simul: boolean, skipSubMux: boolean, nocleanup: boolean, override: string[], videoTitle: string,
ffmpegOptions: string[], mkvmergeOptions: string[] }
export type FuniSubsData = { nosubs?: boolean, sub: boolean, dlsubs: string[] }
export type DownloadData = { id: string, e: string, dubLang: string[], dlsubs: string[], fileName: string, q: number }

View file

@ -62,7 +62,6 @@ export default class Crunchy implements ServiceClass {
public async cli() {
console.log(`\n=== Multi Downloader NX ${packageJson.version} ===\n`);
const argv = yargs.appArgv(this.cfg.cli);
this.debug = argv.debug ?? false;
// load binaries
this.cfg.bin = await yamlCfg.loadBinCfg();
@ -1272,7 +1271,11 @@ export default class Crunchy implements ServiceClass {
path: a.path,
};
}),
videoTitle: options.videoTitle
videoTitle: options.videoTitle,
options: {
ffmpeg: options.ffmpegOptions,
mkvmerge: options.mkvmergeOptions
}
});
const bin = Merger.checkMerger(this.cfg.bin, options.mp4, options.forceMuxer);
// collect fonts info

View file

@ -814,7 +814,11 @@ export default class Funi implements ServiceClass {
videoAndAudio: audioAndVideo,
simul: data.simul,
skipSubMux: data.skipSubMux,
videoTitle: data.videoTitle
videoTitle: data.videoTitle,
options: {
ffmpeg: data.ffmpegOptions,
mkvmerge: data.mkvmergeOptions
}
});
if(mergerBin.MKVmerge){

View file

@ -1,7 +1,7 @@
import yargs, { Choices } from 'yargs';
import { args, AvailableMuxer, groups } from './module.args';
let argvC: { [x: string]: unknown; force: 'Y'|'y'|'N'|'n'|'C'|'c', skipUpdate: boolean, videoTitle: string, override: string[], fsRetryTime: number, forceMuxer: AvailableMuxer|undefined; username: string|undefined, password: string|undefined, silentAuth: boolean, skipSubMux: boolean, downloadArchive: boolean, addArchive: boolean, but: boolean, auth: boolean | undefined; dlFonts: boolean | undefined; search: string | undefined; 'search-type': string; page: number | undefined; 'search-locale': string; new: boolean | undefined; 'movie-listing': string | undefined; series: string | undefined; s: string | undefined; e: string | undefined; q: number; x: number; kstream: number; partsize: number; hslang: string; dlsubs: string[]; novids: boolean | undefined; noaudio: boolean | undefined; nosubs: boolean | undefined; dubLang: string[]; all: boolean; fontSize: number; allDubs: boolean; timeout: number; simul: boolean; mp4: boolean; skipmux: boolean | undefined; fileName: string; numbers: number; nosess: string; debug: boolean | undefined; nocleanup: boolean; help: boolean | undefined; service: 'funi' | 'crunchy'; update: boolean; fontName: string | undefined; _: (string | number)[]; $0: string; };
let argvC: { [x: string]: unknown; ffmpegOptions: string[], mkvmergeOptions: string[], force: 'Y'|'y'|'N'|'n'|'C'|'c', skipUpdate: boolean, videoTitle: string, override: string[], fsRetryTime: number, forceMuxer: AvailableMuxer|undefined; username: string|undefined, password: string|undefined, silentAuth: boolean, skipSubMux: boolean, downloadArchive: boolean, addArchive: boolean, but: boolean, auth: boolean | undefined; dlFonts: boolean | undefined; search: string | undefined; 'search-type': string; page: number | undefined; 'search-locale': string; new: boolean | undefined; 'movie-listing': string | undefined; series: string | undefined; s: string | undefined; e: string | undefined; q: number; x: number; kstream: number; partsize: number; hslang: string; dlsubs: string[]; novids: boolean | undefined; noaudio: boolean | undefined; nosubs: boolean | undefined; dubLang: string[]; all: boolean; fontSize: number; allDubs: boolean; timeout: number; simul: boolean; mp4: boolean; skipmux: boolean | undefined; fileName: string; numbers: number; nosess: string; debug: boolean | undefined; nocleanup: boolean; help: boolean | undefined; service: 'funi' | 'crunchy'; update: boolean; fontName: string | undefined; _: (string | number)[]; $0: string; };
export type ArgvType = typeof argvC;

View file

@ -609,6 +609,34 @@ const args: TAppArg<boolean|number|string|unknown[]>[] = [
type: 'string',
usage: '${option}',
choices: [ 'y', 'Y', 'n', 'N', 'c', 'C' ]
},
{
name: 'mkvmergeOptions',
describe: 'Set the options given to mkvmerge',
docDescribe: true,
group: 'mux',
service: 'both',
type: 'array',
usage: '${args}',
default: {
default: [
'--no-date',
'--disable-track-statistics-tags',
'--engage no_variable_data'
]
}
},
{
name: 'ffmpegOptions',
describe: 'Set the options given to ffmpeg',
docDescribe: true,
group: 'mux',
service: 'both',
type: 'array',
usage: '${args}',
default: {
default: []
}
}
];

View file

@ -35,7 +35,10 @@ export type MergerOptions = {
simul?: boolean,
fonts?: ParsedFont[],
skipSubMux?: boolean,
coustomOptions?: string,
options: {
ffmpeg: string[],
mkvmerge: string[]
},
}
class Merger {
@ -110,9 +113,9 @@ class Merger {
this.options.output.split('.').pop()?.toLowerCase() === 'mp4' ? '-c:s mov_text' : '-c:s ass',
...this.options.subtitles.map((sub, subindex) => `-metadata:s:s:${subindex} title="${
(sub.language.language || sub.language.name) + `${sub.closedCaption === true ? ' CC' : ''}`
}" -metadata:s:s:${subindex} language=${sub.language.code}`),
this.options.coustomOptions ?? ''
}" -metadata:s:s:${subindex} language=${sub.language.code}`)
);
args.push(...this.options.options.ffmpeg);
args.push(`"${this.options.output}"`);
return args.join(' ');
}
@ -134,11 +137,7 @@ class Merger {
let hasVideo = false;
args.push(`-o "${this.options.output}"`);
args.push(
'--no-date',
'--disable-track-statistics-tags',
'--engage no_variable_data',
);
args.push(...this.options.options.mkvmerge);
for (const vid of this.options.onlyVid) {
if (!hasVideo) {