show specific error for infringing file removed error
This commit is contained in:
@@ -153,6 +153,10 @@ async function resolve({ ip, isBrowser, apiKey, infoHash, cachedEntryInfo, fileI
|
||||
console.log(`Access denied to RealDebrid ${infoHash} [${fileIndex}]`);
|
||||
return StaticResponse.FAILED_ACCESS;
|
||||
}
|
||||
if (infringingFile(error)) {
|
||||
console.log(`Infringing file removed from RealDebrid ${infoHash} [${fileIndex}]`);
|
||||
return StaticResponse.FAILED_INFRINGEMENT;
|
||||
}
|
||||
return Promise.reject(`Failed RealDebrid adding torrent ${JSON.stringify(error)}`);
|
||||
});
|
||||
}
|
||||
@@ -265,7 +269,7 @@ async function _unrestrictLink(RD, torrent, fileIndex, isBrowser) {
|
||||
const targetFile = torrent.files.find(file => file.id === fileIndex + 1)
|
||||
|| torrent.files.filter(file => file.selected).sort((a, b) => b.bytes - a.bytes)[0];
|
||||
if (!targetFile.selected) {
|
||||
console.log(`Target RealDebrid file is not downloaded: ${JSON.stringify(torrent)}`);
|
||||
console.log(`Target RealDebrid file is not downloaded: ${JSON.stringify(targetFile)}`);
|
||||
await _recreateTorrentId(RD, torrent.hash.toLowerCase(), fileIndex);
|
||||
return StaticResponse.DOWNLOADING;
|
||||
}
|
||||
@@ -276,7 +280,7 @@ async function _unrestrictLink(RD, torrent, fileIndex, isBrowser) {
|
||||
: torrent.links[selectedFiles.indexOf(targetFile)];
|
||||
|
||||
if (!fileLink || !fileLink.length) {
|
||||
return Promise.reject(`No RealDebrid links found for ${torrent.hash} [${fileIndex}]`);
|
||||
return Promise.reject(`No RealDebrid links found for ${torrent.hash} [${fileIndex}]: ${JSON.stringify(torrent)}`);
|
||||
}
|
||||
|
||||
return _unrestrictFileLink(RD, fileLink, torrent, fileIndex, isBrowser);
|
||||
@@ -334,6 +338,10 @@ function accessDeniedError(error) {
|
||||
return [9, 20].includes(error && error.code);
|
||||
}
|
||||
|
||||
function infringingFile(error) {
|
||||
return error && error.code === 35;
|
||||
}
|
||||
|
||||
async function getDefaultOptions(ip) {
|
||||
return { ip, timeout: 30000 };
|
||||
}
|
||||
|
||||
@@ -7,5 +7,6 @@ module.exports = {
|
||||
FAILED_ACCESS: `${RESOLVER_HOST}/videos/failed_access_v2.mp4`,
|
||||
FAILED_RAR: `${RESOLVER_HOST}/videos/failed_rar_v2.mp4`,
|
||||
FAILED_OPENING: `${RESOLVER_HOST}/videos/failed_opening_v2.mp4`,
|
||||
FAILED_UNEXPECTED: `${RESOLVER_HOST}/videos/failed_unexpected_v2.mp4`
|
||||
FAILED_UNEXPECTED: `${RESOLVER_HOST}/videos/failed_unexpected_v2.mp4`,
|
||||
FAILED_INFRINGEMENT: `${RESOLVER_HOST}/videos/failed_infringement_v2.mp4`
|
||||
}
|
||||
12
addon/package-lock.json
generated
12
addon/package-lock.json
generated
@@ -24,7 +24,7 @@
|
||||
"pg": "^8.7.3",
|
||||
"pg-hstore": "^2.3.4",
|
||||
"premiumize-api": "^1.0.3",
|
||||
"real-debrid-api": "git://github.com/TheBeastLT/node-real-debrid.git#874f150f4c0b6ea5c67535c82b47f75ad96e50b8",
|
||||
"real-debrid-api": "git://github.com/TheBeastLT/node-real-debrid.git#d1f7eaa8593b947edbfbc8a92a176448b48ef445",
|
||||
"request-ip": "^2.2.0",
|
||||
"sequelize": "^6.21.0",
|
||||
"stremio-addon-sdk": "^1.6.1",
|
||||
@@ -1676,8 +1676,8 @@
|
||||
},
|
||||
"node_modules/real-debrid-api": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "git+ssh://git@github.com/TheBeastLT/node-real-debrid.git#874f150f4c0b6ea5c67535c82b47f75ad96e50b8",
|
||||
"integrity": "sha512-O4xuqjj9cAbrrYn3MlPoNLQemUJUyeRrfAVPMcpbzP6hH5wPQ6lrzcP6KBtnKicV013NJ1HYt6Gzyc03ZHSWTA==",
|
||||
"resolved": "git+ssh://git@github.com/TheBeastLT/node-real-debrid.git#d1f7eaa8593b947edbfbc8a92a176448b48ef445",
|
||||
"integrity": "sha512-P4eoA7/wvDM6/l06OZYX4CBnIzsTNwebdS6fZ4u6LZ3fcJqTzWz3D63xBDZmfcOca/OeUN4ncFld+KxvrNr0oA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"request": "^2.83.0"
|
||||
@@ -3695,9 +3695,9 @@
|
||||
}
|
||||
},
|
||||
"real-debrid-api": {
|
||||
"version": "git+ssh://git@github.com/TheBeastLT/node-real-debrid.git#874f150f4c0b6ea5c67535c82b47f75ad96e50b8",
|
||||
"integrity": "sha512-O4xuqjj9cAbrrYn3MlPoNLQemUJUyeRrfAVPMcpbzP6hH5wPQ6lrzcP6KBtnKicV013NJ1HYt6Gzyc03ZHSWTA==",
|
||||
"from": "real-debrid-api@git://github.com/TheBeastLT/node-real-debrid.git#874f150f4c0b6ea5c67535c82b47f75ad96e50b8",
|
||||
"version": "git+ssh://git@github.com/TheBeastLT/node-real-debrid.git#d1f7eaa8593b947edbfbc8a92a176448b48ef445",
|
||||
"integrity": "sha512-P4eoA7/wvDM6/l06OZYX4CBnIzsTNwebdS6fZ4u6LZ3fcJqTzWz3D63xBDZmfcOca/OeUN4ncFld+KxvrNr0oA==",
|
||||
"from": "real-debrid-api@git://github.com/TheBeastLT/node-real-debrid.git#d1f7eaa8593b947edbfbc8a92a176448b48ef445",
|
||||
"requires": {
|
||||
"request": "^2.83.0"
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
"pg": "^8.7.3",
|
||||
"pg-hstore": "^2.3.4",
|
||||
"premiumize-api": "^1.0.3",
|
||||
"real-debrid-api": "git://github.com/TheBeastLT/node-real-debrid.git#874f150f4c0b6ea5c67535c82b47f75ad96e50b8",
|
||||
"real-debrid-api": "git://github.com/TheBeastLT/node-real-debrid.git#d1f7eaa8593b947edbfbc8a92a176448b48ef445",
|
||||
"request-ip": "^2.2.0",
|
||||
"sequelize": "^6.21.0",
|
||||
"stremio-addon-sdk": "^1.6.1",
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
addon/static/videos/failed_infringement_v2.mp4
Normal file
BIN
addon/static/videos/failed_infringement_v2.mp4
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user