Add --waittime flag
Will wait between downloads, set in milliseconds. Setting this high should help when downloading large numbers of items.
This commit is contained in:
parent
e32d2fdefe
commit
2dc6b3968c
4 changed files with 21 additions and 0 deletions
|
|
@ -259,6 +259,12 @@ export default class Crunchy implements ServiceClass {
|
|||
return true;
|
||||
}
|
||||
|
||||
public sleep(ms: number) {
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(resolve, ms);
|
||||
});
|
||||
}
|
||||
|
||||
public async refreshToken(ifNeeded = false, silent = false) {
|
||||
if(!this.token.access_token && !this.token.refresh_token || this.token.access_token && !this.token.refresh_token){
|
||||
await this.doAnonymousAuth();
|
||||
|
|
@ -1415,6 +1421,7 @@ export default class Crunchy implements ServiceClass {
|
|||
else{
|
||||
console.info('Subtitles downloading skipped!');
|
||||
}
|
||||
await this.sleep(options.waittime);
|
||||
}
|
||||
return {
|
||||
error: dlFailed,
|
||||
|
|
|
|||
|
|
@ -675,6 +675,7 @@ export default class Hidive implements ServiceClass {
|
|||
fileName = parseFileName(options.fileName, variables, options.numbers, options.override).join(path.sep);
|
||||
console.info('Downloading skipped!');
|
||||
}
|
||||
await this.sleep(options.waittime);
|
||||
}
|
||||
|
||||
if(options.dlsubs.indexOf('all') > -1){
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ let argvC: {
|
|||
fontSize: number;
|
||||
allDubs: boolean;
|
||||
timeout: number;
|
||||
waittime: number;
|
||||
simul: boolean;
|
||||
mp4: boolean;
|
||||
skipmux: boolean | undefined;
|
||||
|
|
|
|||
|
|
@ -371,6 +371,18 @@ const args: TAppArg<boolean|number|string|unknown[]>[] = [
|
|||
default: 15 * 1000
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'waittime',
|
||||
group: 'dl',
|
||||
type: 'number',
|
||||
describe: 'Set the time the program waits between downloads. Set in millisecods',
|
||||
docDescribe: true,
|
||||
service: ['crunchy','hidive'],
|
||||
usage: '${waittime}',
|
||||
default: {
|
||||
default: 0 * 1000
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'simul',
|
||||
group: 'dl',
|
||||
|
|
|
|||
Loading…
Reference in a new issue