[scraper] handles torrent files from object without index

This commit is contained in:
TheBeastLT
2020-12-27 20:04:56 +01:00
parent 0004fbcd9f
commit 21072dc4d7
2 changed files with 10 additions and 1 deletions

View File

@@ -71,7 +71,13 @@ async function reapplyEpisodeDecomposing(infoHash, includeSourceFiles = true) {
const kitsuId = undefined;
const imdbId = kitsuId
? undefined
: mostCommonValue(storedFiles.map(file => file.imdbId)) || await getImdbId(parse(torrent.title));
: mostCommonValue(storedFiles.map(file => file.imdbId))
|| await getImdbId(parse(torrent.title)).catch(() => undefined);
if (!imdbId && !kitsuId) {
console.log(`imdbId or kitsuId not found: ${torrent.provider} ${torrent.title}`);
return Promise.resolve();
}
return parseTorrentFiles({ ...torrent.get(), imdbId, kitsuId, files })
.then(torrentContents => torrentContents.videos)