Funimation but && crunchyroll all

This commit is contained in:
Izuco 2021-11-20 15:12:10 +01:00
parent 7beff58108
commit cb346284ba
No known key found for this signature in database
GPG key ID: 318460063D70949F
5 changed files with 23 additions and 11 deletions

View file

@ -94,8 +94,8 @@ export default (async () => {
await refreshToken();
if (argv.dubLang.length > 1) {
console.log('[INFO] One show can only be downloaded with one dub. Use --srz instead.');
argv.dubLang = argv.dubLang[0];
}
argv.dubLang = argv.dubLang[0];
await getSeasonById();
}
else if(argv.e){
@ -699,7 +699,7 @@ async function getSeasonById(){
? 'S' + epNumList.sp.toString().padStart(epNumLen['S'], '0')
: '' + parseInt(epNum, 10).toString().padStart(epNumLen['E'], '0')
);
if(selEps.indexOf(selEpId) > -1 && !item.isSelected && item.playback){
if((argv.all && item.playback) || (selEps.indexOf(selEpId) > -1 && !item.isSelected && item.playback)){
selectedMedia.push(epMeta);
item.isSelected = true;
}
@ -1315,7 +1315,7 @@ const itemSelectMultiDub = (eps: Record<string, {
? 'S' + epNumList.sp.toString().padStart(epNumLen['S'], '0')
: '' + parseInt(epNum, 10).toString().padStart(epNumLen['E'], '0')
);
if(selEps.indexOf(selEpId) > -1 && item.playback){
if((argv.all || selEps.indexOf(selEpId) > -1) && item.playback){
if (Object.prototype.hasOwnProperty.call(ret, key)) {
const epMe = ret[key];
epMe.data.push({

View file

@ -209,7 +209,7 @@ async function getShow(){
return e;
});
const epSelList = parseSelect(argv.e as string);
const epSelList = parseSelect(argv.e as string, argv.but);
const fnSlug: {
title: string,

View file

@ -10,6 +10,11 @@ import update from './modules/module.updater';
await update(argv.update);
if (argv.all && argv.but) {
console.log('[ERROR] --all and --but exclude each other!')
return;
}
if (argv.service === 'funi') {
(await import('./funi')).default();
} else if (argv.service === 'crunchy') {

View file

@ -34,7 +34,7 @@ export type possibleSubs = (
)[];
const subLang: possibleSubs = ['enUS', 'esLA', 'ptBR'];
const dubLang: possibleDubs = ['enUS', 'esLA', 'ptBR', 'zhMN', 'jaJP'];
let argvC: { [x: string]: unknown; 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; subLang: string[]; dlsubs: string | string[]; novids: boolean | undefined; noaudio: boolean | undefined; nosubs: boolean | undefined; dub: possibleDubs; dubLang: string; all: boolean; fontSize: number; allSubs: boolean; 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; 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; subLang: string[]; dlsubs: string | string[]; novids: boolean | undefined; noaudio: boolean | undefined; nosubs: boolean | undefined; dub: possibleDubs; dubLang: string; all: boolean; fontSize: number; allSubs: boolean; 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; };
const appArgv = (cfg: {
[key: string]: unknown
@ -199,7 +199,7 @@ const appArgv = (cfg: {
})
.option('all', {
group: groups.dl,
describe: 'Used to download all episodes from the show (Funi only)',
describe: 'Used to download all episodes from the show',
type: 'boolean',
default: parseDefault<boolean>('all', false)
})
@ -299,6 +299,12 @@ const appArgv = (cfg: {
type: 'string',
default: parseDefault<string|undefined>('fontName', undefined)
})
.option('but', {
group: groups.dl,
describe: 'Download everything but',
type: 'boolean',
default: false
})
.parseSync();
argvC = argv;
return argv;

View file

@ -1,11 +1,11 @@
const parseSelect = (selectString: string) : {
const parseSelect = (selectString: string, but = false) : {
isSelected: (val: string) => boolean,
values: string[]
} => {
if (!selectString)
return {
values: [],
isSelected: () => false
isSelected: () => but
};
const parts = selectString.split(',');
const select: string[] = [];
@ -82,10 +82,11 @@ const parseSelect = (selectString: string) : {
if (isNaN(number)) {
return false;
}
return select.includes(`${letter}${number}`);
const included = select.includes(`${letter}${number}`);
return but ? !included : included
} else {
return select.includes(`${parseInt(st)}`);
const included = select.includes(`${parseInt(st)}`);
return but ? !included : included
}
}
};