[addon] uses forked rd library

This commit is contained in:
TheBeastLT
2020-04-03 10:50:24 +02:00
parent c2e42634b7
commit 4ea86742a6
3 changed files with 11 additions and 16 deletions

View File

@@ -6,7 +6,11 @@ const RESOLVER_HOST = process.env.RESOLVER_HOST || 'http://localhost:7000';
async function applyMoch(streams, apiKey) { async function applyMoch(streams, apiKey) {
const RD = new RealDebridClient(apiKey); const RD = new RealDebridClient(apiKey);
const hashes = streams.map(stream => stream.infoHash); const hashes = streams.map(stream => stream.infoHash);
const available = await _instantAvailability(RD, hashes); const available = await RD.torrents.instantAvailability(hashes)
.catch(error => {
console.warn('Failed cached torrent availability request: ', error);
return undefined;
});
if (available) { if (available) {
streams.forEach(stream => { streams.forEach(stream => {
const cachedEntry = available[stream.infoHash]; const cachedEntry = available[stream.infoHash];
@@ -23,14 +27,6 @@ async function applyMoch(streams, apiKey) {
return streams; return streams;
} }
async function _instantAvailability(RD, hashes) {
return RD._get(`torrents/instantAvailability/${hashes.join('/')}`)
.catch(error => {
console.warn('Failed cached torrent availability request: ', error);
return undefined;
});
}
function getCachedFileIds(fileIndex, hosterResults) { function getCachedFileIds(fileIndex, hosterResults) {
if (!hosterResults || Array.isArray(hosterResults)) { if (!hosterResults || Array.isArray(hosterResults)) {
return []; return [];

View File

@@ -1729,9 +1729,9 @@
"integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=" "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM="
}, },
"psl": { "psl": {
"version": "1.7.0", "version": "1.8.0",
"resolved": "https://registry.npmjs.org/psl/-/psl-1.7.0.tgz", "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz",
"integrity": "sha512-5NsSEDv8zY70ScRnOTn7bK7eanl2MvFrOrS/R6x+dBt5g1ghnj9Zv90kO8GwT8gxcu2ANyFprnFYB85IogIJOQ==" "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ=="
}, },
"punycode": { "punycode": {
"version": "2.1.1", "version": "2.1.1",
@@ -1781,9 +1781,8 @@
} }
}, },
"real-debrid-api": { "real-debrid-api": {
"version": "1.0.1", "version": "git://github.com/TheBeastLT/node-real-debrid.git#935a5c23ae809edbcd2a111526a7f74d6767c50d",
"resolved": "https://registry.npmjs.org/real-debrid-api/-/real-debrid-api-1.0.1.tgz", "from": "git://github.com/TheBeastLT/node-real-debrid.git#935a5c23ae809edbcd2a111526a7f74d6767c50d",
"integrity": "sha512-Rva3aZ62R/KDV7ydUALrVu8YbAuPLLmThWMlmVMshUEBQk74ybRyUv5WTvfrd9i94v+0V9YeZle0pldv5cQ2+g==",
"requires": { "requires": {
"request": "^2.83.0" "request": "^2.83.0"
} }

View File

@@ -15,7 +15,7 @@
"parse-torrent-title": "git://github.com/TheBeastLT/parse-torrent-title.git#afd4a374276420c13c52df8e3d07ae7699c46b60", "parse-torrent-title": "git://github.com/TheBeastLT/parse-torrent-title.git#afd4a374276420c13c52df8e3d07ae7699c46b60",
"pg": "^7.8.2", "pg": "^7.8.2",
"pg-hstore": "^2.3.2", "pg-hstore": "^2.3.2",
"real-debrid-api": "^1.0.1", "real-debrid-api": "git://github.com/TheBeastLT/node-real-debrid.git#935a5c23ae809edbcd2a111526a7f74d6767c50d",
"sequelize": "^4.43.0", "sequelize": "^4.43.0",
"stremio-addon-sdk": "^1.6.1" "stremio-addon-sdk": "^1.6.1"
}, },