From 678e05b7aff81d10d4d4870b09039acb6c0a5275 Mon Sep 17 00:00:00 2001 From: TheBeastLT Date: Tue, 9 Mar 2021 18:08:53 +0100 Subject: [PATCH] [addon] handle rd magnet error status --- addon/moch/realdebrid.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/addon/moch/realdebrid.js b/addon/moch/realdebrid.js index 9dc197d..4e35bdc 100644 --- a/addon/moch/realdebrid.js +++ b/addon/moch/realdebrid.js @@ -132,6 +132,9 @@ async function _resolve(RD, infoHash, cachedEntryInfo, fileIndex) { } else if (torrent && statusDownloading(torrent.status)) { console.log(`Downloading to RealDebrid ${infoHash} [${fileIndex}]...`); return StaticResponse.DOWNLOADING; + } else if (torrent && statusMagnetError(torrent.status)) { + console.log(`Failed RealDebrid opening torrent ${infoHash} [${fileIndex}] due to magnet error`); + return StaticResponse.FAILED_OPENING; } else if (torrent && (statusWaitingSelection(torrent.status) || statusOpening(torrent.status))) { console.log(`Trying to select files on RealDebrid ${infoHash} [${fileIndex}]...`); return _selectTorrentFiles(RD, torrent) @@ -252,6 +255,10 @@ function statusError(status) { return ['error', 'magnet_error', 'dead'].includes(status); } +function statusMagnetError(status) { + return status === 'magnet_error'; +} + function statusOpening(status) { return status === 'magnet_conversion'; }