From a4a675ab2a2f90010336e49f6a99ce648f294b6d Mon Sep 17 00:00:00 2001 From: TheBeastLT Date: Tue, 10 Mar 2020 16:22:11 +0100 Subject: [PATCH] adds metadata type check for anime movies to bypass file fetching --- scraper/lib/metadata.js | 3 ++- scraper/lib/torrentFiles.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/scraper/lib/metadata.js b/scraper/lib/metadata.js index 0b8796b..0e0a632 100644 --- a/scraper/lib/metadata.js +++ b/scraper/lib/metadata.js @@ -19,7 +19,7 @@ function getMetadata(id, type = Type.SERIES) { () => _requestMetadata(`${KITSU_URL}/meta/${metaType}/${key}.json`) .catch(() => _requestMetadata(`${CINEMETA_URL}/meta/${metaType}/${key}.json`)) .catch((error) => { - throw new Error(`failed metadata query ${kitsuId} due: ${error.message}`); + throw new Error(`failed metadata query ${key} due: ${error.message}`); })); } @@ -31,6 +31,7 @@ function _requestMetadata(url) { return { kitsuId: body.meta.kitsu_id, imdbId: body.meta.imdb_id, + type: body.meta.type, title: body.meta.name, year: body.meta.year, country: body.meta.country, diff --git a/scraper/lib/torrentFiles.js b/scraper/lib/torrentFiles.js index 9191190..0800d2c 100644 --- a/scraper/lib/torrentFiles.js +++ b/scraper/lib/torrentFiles.js @@ -16,7 +16,7 @@ async function parseTorrentFiles(torrent) { // throw new Error(`Mismatching entry type for ${torrent.name}: ${torrent.type}!=${metadata.type}`); // } - if (torrent.type === Type.MOVIE && !parsedTorrentName.seasons) { + if (torrent.type === Type.MOVIE && !parsedTorrentName.seasons || metadata.type === Type.MOVIE) { if (parsedTorrentName.complete) { return torrentFiles(torrent) .then(files => files.filter(file => file.size > MIN_SIZE))