mirror of
https://github.com/knightcrawler-stremio/knightcrawler.git
synced 2024-12-20 03:29:51 +00:00
[scraper] pass torrent link when updating contents
This commit is contained in:
@@ -100,7 +100,7 @@ async function checkAndUpdateTorrent(torrent) {
|
|||||||
if (!storedTorrent) {
|
if (!storedTorrent) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return createTorrentContents(storedTorrent)
|
return createTorrentContents({ ...storedTorrent.get(), torrentLink: torrent.torrentLink })
|
||||||
.then(() => updateTorrentSeeders(torrent));
|
.then(() => updateTorrentSeeders(torrent));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,7 +116,7 @@ async function createTorrentContents(torrent) {
|
|||||||
const imdbId = Promises.mostCommonValue(storedVideos.map(stored => stored.imdbId));
|
const imdbId = Promises.mostCommonValue(storedVideos.map(stored => stored.imdbId));
|
||||||
const kitsuId = Promises.mostCommonValue(storedVideos.map(stored => stored.kitsuId));
|
const kitsuId = Promises.mostCommonValue(storedVideos.map(stored => stored.kitsuId));
|
||||||
|
|
||||||
const { contents, videos, subtitles } = await parseTorrentFiles({ ...torrent.get(), imdbId, kitsuId })
|
const { contents, videos, subtitles } = await parseTorrentFiles({ ...torrent, imdbId, kitsuId })
|
||||||
.then(torrentContents => notOpenedVideo ? torrentContents : { ...torrentContents, videos: storedVideos })
|
.then(torrentContents => notOpenedVideo ? torrentContents : { ...torrentContents, videos: storedVideos })
|
||||||
.then(torrentContents => assignSubtitles(torrentContents))
|
.then(torrentContents => assignSubtitles(torrentContents))
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
@@ -138,7 +138,7 @@ async function createTorrentContents(torrent) {
|
|||||||
// no videos available or more than one new videos were in the torrent
|
// no videos available or more than one new videos were in the torrent
|
||||||
const shouldDeleteOld = notOpenedVideo && videos.every(video => !video.id);
|
const shouldDeleteOld = notOpenedVideo && videos.every(video => !video.id);
|
||||||
|
|
||||||
return repository.createTorrent({ ...torrent.get(), contents, subtitles })
|
return repository.createTorrent({ ...torrent, contents, subtitles })
|
||||||
.then(() => {
|
.then(() => {
|
||||||
if (shouldDeleteOld) {
|
if (shouldDeleteOld) {
|
||||||
console.error(`Deleting old video for [${torrent.infoHash}] ${torrent.title}`)
|
console.error(`Deleting old video for [${torrent.infoHash}] ${torrent.title}`)
|
||||||
|
|||||||
Reference in New Issue
Block a user