[addon] adds putio moch provider closes #6

This commit is contained in:
TheBeastLT
2020-05-12 15:06:01 +02:00
parent ad7076f3f7
commit 313971fca0
6 changed files with 281 additions and 2 deletions

View File

@@ -1,6 +1,7 @@
const RealDebridClient = require('real-debrid-api');
const { encode } = require('magnet-uri');
const isVideo = require('../lib/video');
const delay = require('./delay');
const StaticResponse = require('./static');
const { getRandomProxy, getRandomUserAgent } = require('../lib/request_helper');
const { cacheWrapProxy, cacheUserAgent } = require('../lib/cache');
@@ -103,8 +104,7 @@ async function _selectTorrentFiles(RD, torrent, cachedFileIds) {
torrent = torrent.status ? torrent : await RD.torrents.info(torrent.id);
if (torrent && statusOpening(torrent.status)) {
// sleep for 2 seconds, maybe the torrent will be converted
await new Promise((resolve) => setTimeout(resolve, 2000));
torrent = await RD.torrents.info(torrent.id);
torrent = await delay(2000).then(() => RD.torrents.info(torrent.id));
}
if (torrent && torrent.files && statusWaitingSelection(torrent.status)) {
const videoFileIds = torrent.files