mirror of
https://github.com/knightcrawler-stremio/knightcrawler.git
synced 2024-12-20 03:29:51 +00:00
adds rarbg dump scraper based on scraped imdb ids
This commit is contained in:
@@ -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}`));
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user