mirror of
https://github.com/knightcrawler-stremio/knightcrawler.git
synced 2024-12-20 03:29:51 +00:00
[scraper] overwrite torrent type if differs from metadata type
This commit is contained in:
@@ -16,6 +16,10 @@ async function parseTorrentFiles(torrent) {
|
|||||||
// if (metadata && metadata.type !== torrent.type && torrent.type !== Type.ANIME) {
|
// if (metadata && metadata.type !== torrent.type && torrent.type !== Type.ANIME) {
|
||||||
// throw new Error(`Mismatching entry type for ${torrent.name}: ${torrent.type}!=${metadata.type}`);
|
// throw new Error(`Mismatching entry type for ${torrent.name}: ${torrent.type}!=${metadata.type}`);
|
||||||
// }
|
// }
|
||||||
|
if (torrent.type === Type.SERIES && metadata && metadata.type === Type.MOVIE) {
|
||||||
|
// it's actually a movie
|
||||||
|
torrent.type = Type.MOVIE;
|
||||||
|
}
|
||||||
|
|
||||||
if (torrent.type === Type.MOVIE && !parsedTorrentName.seasons || metadata && metadata.type === Type.MOVIE) {
|
if (torrent.type === Type.MOVIE && !parsedTorrentName.seasons || metadata && metadata.type === Type.MOVIE) {
|
||||||
if (parsedTorrentName.complete) {
|
if (parsedTorrentName.complete) {
|
||||||
@@ -45,6 +49,9 @@ async function parseTorrentFiles(torrent) {
|
|||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// const parsedSeriesTorrentName = seriesParser.parse(torrent.title);
|
||||||
|
// parsedTorrentName.episodes = parsedSeriesTorrentName.episodes;
|
||||||
|
// parsedTorrentName.episode = parsedSeriesTorrentName.episode;
|
||||||
return getSeriesFiles(torrent, parsedTorrentName)
|
return getSeriesFiles(torrent, parsedTorrentName)
|
||||||
.then((files) => files
|
.then((files) => files
|
||||||
.filter((file) => file.size > MIN_SIZE)
|
.filter((file) => file.size > MIN_SIZE)
|
||||||
|
|||||||
@@ -72,13 +72,17 @@ async function initMapping() {
|
|||||||
.then((shows) => Promise.all(shows.map((show) => limiter.schedule(() => enrichShow(show)))))
|
.then((shows) => Promise.all(shows.map((show) => limiter.schedule(() => enrichShow(show)))))
|
||||||
.then((shows) => shows.reduce((map, show) => (map[show.title] = show, map), showMappings));
|
.then((shows) => shows.reduce((map, show) => (map[show.title] = show, map), showMappings));
|
||||||
|
|
||||||
fs.writeFile("./scrapers/horriblesubs/horriblesubs_mapping.json", JSON.stringify(shows), 'utf8', function (err) {
|
fs.writeFile(
|
||||||
if (err) {
|
"./scraper/scrapers/horriblesubs/horriblesubs_mapping.json",
|
||||||
console.log("An error occurred while writing JSON Object to File.");
|
JSON.stringify(shows), 'utf8',
|
||||||
} else {
|
(err) => {
|
||||||
console.log(`${NAME}: finished kitsu mapping`);
|
if (err) {
|
||||||
}
|
console.log("An error occurred while writing JSON Object to File.", err);
|
||||||
});
|
} else {
|
||||||
|
console.log(`${NAME}: finished kitsu mapping`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function enrichShow(show) {
|
async function enrichShow(show) {
|
||||||
|
|||||||
Reference in New Issue
Block a user