[scraper] fixes update seeders method

This commit is contained in:
TheBeastLT
2020-03-30 14:42:00 +02:00
parent 04b3d8a774
commit 97cbe5d6c1
8 changed files with 53 additions and 13 deletions

View File

@@ -107,7 +107,7 @@ function getTorrent(torrent) {
if (!result) {
throw new Error(`torrent not found: ${torrent.infoHash}`);
}
return result.dataValues;
return result;
})
}
@@ -115,6 +115,14 @@ function getTorrentsBasedOnTitle(titleQuery, type) {
return Torrent.findAll({ where: { title: { [Op.regexp]: `${titleQuery}` }, type: type } });
}
function getTorrentsWithoutId(provider) {
return Torrent.findAll({ where: { provider: provider, torrentId: { [Op.is]: null } }, limit: 100 });
}
function getTorrentsUpdatedBetween(provider, startDate, endDate) {
return Torrent.findAll({ where: { provider: provider, updatedAt: { [Op.gte]: startDate, [Op.lte]: endDate } } });
}
function createTorrent(torrent) {
return Torrent.upsert(torrent);
}
@@ -176,5 +184,7 @@ module.exports = {
deleteFile,
getSkipTorrent,
createSkipTorrent,
createFailedImdbTorrent
createFailedImdbTorrent,
getTorrentsWithoutId,
getTorrentsUpdatedBetween
};