adds manual reapply step to decompose episodes again

This commit is contained in:
TheBeastLT
2020-02-25 08:13:08 +01:00
parent 9aad6a5148
commit 75053fccd0
3 changed files with 39 additions and 5 deletions

View File

@@ -35,7 +35,8 @@ module.exports.updateCurrentSeeders = function (torrent) {
};
module.exports.torrentFiles = function (torrent) {
return filesFromTorrentFile(torrent)
return getFilesFromObject(torrent)
.catch(() => filesFromTorrentFile(torrent))
.catch(() => filesFromTorrentStream(torrent))
.catch(() => filesFromCache(torrent.infoHash))
.then((files) => filterVideos(files))
@@ -43,6 +44,13 @@ module.exports.torrentFiles = function (torrent) {
.then((files) => filterExtras(files));
};
function getFilesFromObject(torrent) {
if (torrent.files && torrent.files.length) {
return Promise.resolve(torrent.files);
}
return Promise.reject("No files in the object");
}
function filesFromCache(infoHash) {
return retrieveTorrentFiles(infoHash)
.then((files) => files.map((file) => ({