From 3b2e863dcdda0339700d0f69299e32b9217d83c8 Mon Sep 17 00:00:00 2001 From: TheBeastLT Date: Wed, 9 Sep 2020 20:38:13 +0200 Subject: [PATCH] [addon] removes excessive logging from rd --- addon/moch/realdebrid.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/addon/moch/realdebrid.js b/addon/moch/realdebrid.js index 5f4dfcf..fa7b54b 100644 --- a/addon/moch/realdebrid.js +++ b/addon/moch/realdebrid.js @@ -57,10 +57,9 @@ async function resolve({ apiKey, infoHash, cachedEntryInfo, fileIndex }) { const options = await getDefaultOptions(apiKey); const RD = new RealDebridClient(apiKey, options); const torrentId = await _createOrFindTorrentId(RD, infoHash, cachedEntryInfo, fileIndex); - console.log(`Getting torrent info ${infoHash}`) const torrent = await _getTorrentInfo(RD, torrentId); if (torrent && statusReady(torrent.status)) { - console.log(`Trying unrestrict torrent ${infoHash}`) + console.log(`Trying to unrestrict torrent ${infoHash} [${fileIndex}]`) return _unrestrictLink(RD, torrent, fileIndex); } else if (torrent && statusDownloading(torrent.status)) { console.log(`Downloading to RealDebrid ${infoHash} [${fileIndex}]...`); @@ -97,13 +96,11 @@ async function _retryCreateTorrent(RD, infoHash, cachedFileIds, fileIndex) { } async function _findTorrent(RD, infoHash, fileIndex) { - console.log(`Finding torrent ${infoHash}`) const torrents = await RD.torrents.get(0, 1) || []; const foundTorrents = torrents.filter(torrent => torrent.hash.toLowerCase() === infoHash); const nonFailedTorrents = foundTorrents.filter(torrent => !statusError(torrent.status)); const nonFailedTorrent = await _findBestFitTorrent(RD, nonFailedTorrents, fileIndex); const foundTorrent = nonFailedTorrent || foundTorrents[0]; - console.log(`Found torrent ${foundTorrent && foundTorrent.hash}`) return foundTorrent && foundTorrent.id || Promise.reject('No recent torrent found'); } @@ -126,16 +123,13 @@ async function _getTorrentInfo(RD, torrentId) { } async function _createTorrentId(RD, infoHash, cachedFileIds) { - console.log(`Creating torrent ${infoHash}`) const addedMagnet = await RD.torrents.addMagnet(encode({ infoHash })); await _selectTorrentFiles(RD, { id: addedMagnet.id }, cachedFileIds); - console.log(`Selected files ${infoHash}`) return addedMagnet.id; } async function _selectTorrentFiles(RD, torrent, cachedFileIds) { if (cachedFileIds && !['null', 'undefined'].includes(cachedFileIds)) { - console.log(`Selecting files ${torrent.hash}`) return RD.torrents.selectFiles(torrent.id, cachedFileIds); }