[scraper] handles torrent files from object without index
This commit is contained in:
@@ -130,6 +130,9 @@ function filesAndSizeFromTorrentStream(torrent, timeout = 30000) {
|
||||
}
|
||||
|
||||
function filterVideos(files) {
|
||||
if (files.length === 1 && !Number.isInteger(files[0].fileIndex)) {
|
||||
return files;
|
||||
}
|
||||
const videos = files.filter(file => isVideo(file.path));
|
||||
const maxSize = Math.max(...videos.map(video => video.size));
|
||||
const minSampleRatio = videos.length <= 3 ? 5 : 10;
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user