adds rarbg dump scraper based on scraped imdb ids

This commit is contained in:
TheBeastLT
2020-03-09 15:23:16 +01:00
parent ef09abc4e0
commit 2618694e33
8 changed files with 47214 additions and 7 deletions

View File

@@ -15,6 +15,10 @@ async function createTorrentEntry(torrent) {
torrent.imdbId = await getImdbId(titleInfo, torrent.type)
.catch(() => undefined);
}
if (torrent.imdbId && torrent.imdbId.length > 9 && torrent.imdbId.startsWith('tt0')) {
// sanitize imdbId from redundant zeros
torrent.imdbId = torrent.imdbId.replace(/tt0+([0-9]{7,})$/, 'tt$1');
}
if (!torrent.kitsuId && torrent.type === Type.ANIME) {
torrent.kitsuId = await getKitsuId(titleInfo)
.catch(() => undefined);
@@ -32,8 +36,8 @@ async function createTorrentEntry(torrent) {
return;
}
repository.createTorrent(torrent)
.then(() => files.forEach(file => repository.createFile(file)))
return repository.createTorrent(torrent)
.then(() => Promise.all(files.map(file => repository.createFile(file))))
.then(() => console.log(`Created entry for ${torrent.title}`));
}

View File

@@ -153,12 +153,12 @@ async function decomposeEpisodes(torrent, files, metadata = { episodeCount: [] }
&& sortedEpisodes.every(ep => metadata.episodeCount[div100(ep) - 1] >= mod100(ep))
&& files.every(file => !file.season || file.episodes.every(ep => div100(ep) === file.season))) {
decomposeConcatSeasonAndEpisodeFiles(torrent, files, metadata);
} else if (files.every(file => (!file.season || !metadata.episodeCount[file.season - 1]) && file.date)) {
decomposeDateEpisodeFiles(torrent, files, metadata);
} else if (files.filter(file => !file.isMovie && file.episodes).every(file => !file.season && file.episodes) ||
files.some(file => file.season && file.episodes && file.episodes
.every(ep => metadata.episodeCount[file.season - 1] < ep))) {
decomposeAbsoluteEpisodeFiles(torrent, files, metadata);
} else if (files.every(file => (!file.season || !metadata.episodeCount[file.season - 1]) && file.date)) {
decomposeDateEpisodeFiles(torrent, files, metadata);
}
return files;