handle too big entry for RD and TB

This commit is contained in:
TheBeastLT 2024-11-29 11:08:11 +02:00
parent 951ec718de
commit 0cd3bd4d22
2 changed files with 18 additions and 2 deletions

View file

@ -132,6 +132,10 @@ export async function resolve({ ip, isBrowser, apiKey, infoHash, fileIndex }) {
console.log(`Limits exceeded in RealDebrid ${infoHash} [${fileIndex}]`); console.log(`Limits exceeded in RealDebrid ${infoHash} [${fileIndex}]`);
return StaticResponse.LIMITS_EXCEEDED; return StaticResponse.LIMITS_EXCEEDED;
} }
if (isTorrentTooBigError(error)) {
console.log(`Torrent too big for RealDebrid ${infoHash} [${fileIndex}]`);
return StaticResponse.FAILED_TOO_BIG;
}
return Promise.reject(`Failed RealDebrid adding torrent ${JSON.stringify(error)}`); return Promise.reject(`Failed RealDebrid adding torrent ${JSON.stringify(error)}`);
}); });
} }
@ -350,7 +354,11 @@ function isInfringingFileError(error) {
} }
function isLimitExceededError(error) { function isLimitExceededError(error) {
return [21, 23, 26, 29, 36].includes(error?.code); return [21, 23, 26, 36].includes(error?.code);
}
function isTorrentTooBigError(error) {
return [29].includes(error?.code);
} }
async function getDefaultOptions(ip) { async function getDefaultOptions(ip) {

View file

@ -79,6 +79,10 @@ export async function resolve({ ip, apiKey, infoHash, cachedEntryInfo, fileIndex
console.log(`Limits exceeded to TorBox ${infoHash} [${fileIndex}]`); console.log(`Limits exceeded to TorBox ${infoHash} [${fileIndex}]`);
return StaticResponse.LIMITS_EXCEEDED; return StaticResponse.LIMITS_EXCEEDED;
} }
if (isTorrentTooBigError(error)) {
console.log(`Torrent too big for TorBox ${infoHash} [${fileIndex}]`);
return StaticResponse.FAILED_TOO_BIG;
}
return Promise.reject(`Failed TorBox adding torrent: ${JSON.stringify(error.message || error)}`); return Promise.reject(`Failed TorBox adding torrent: ${JSON.stringify(error.message || error)}`);
}); });
} }
@ -246,5 +250,9 @@ function isAccessDeniedError(error) {
} }
function isLimitExceededError(error) { function isLimitExceededError(error) {
return ['DOWNLOAD_TOO_LARGE', 'MONTHLY_LIMIT', 'COOLDOWN_LIMIT', 'ACTIVE_LIMIT'].includes(error?.error); return ['MONTHLY_LIMIT', 'COOLDOWN_LIMIT', 'ACTIVE_LIMIT'].includes(error?.error);
}
function isTorrentTooBigError(error) {
return ['DOWNLOAD_TOO_LARGE'].includes(error?.error);
} }