mirror of
https://github.com/knightcrawler-stremio/knightcrawler.git
synced 2024-12-20 03:29:51 +00:00
update seeders for new torrents
This commit is contained in:
@@ -24,6 +24,7 @@ function initiateRemoteCache() {
|
||||
options: {
|
||||
collection: 'torrentio_scraper_collection',
|
||||
useUnifiedTopology: true,
|
||||
poolSize: 1
|
||||
},
|
||||
ttl: GLOBAL_TTL,
|
||||
ignoreCacheErrors: true
|
||||
|
||||
@@ -187,7 +187,7 @@ function getTorrentsWithoutSize() {
|
||||
});
|
||||
}
|
||||
|
||||
function getUpdateSeedersTorrents(limit = 100) {
|
||||
function getUpdateSeedersTorrents(limit = 50) {
|
||||
const until = moment().subtract(7, 'days').format('YYYY-MM-DD');
|
||||
return Torrent.findAll({
|
||||
where: literal(`torrent."updatedAt" < \'${until}\'`),
|
||||
@@ -199,6 +199,19 @@ function getUpdateSeedersTorrents(limit = 100) {
|
||||
});
|
||||
}
|
||||
|
||||
function getUpdateSeedersNewTorrents(limit = 50) {
|
||||
const lastUpdate = moment().subtract(12, 'hours').format('YYYY-MM-DD');
|
||||
const createdAfter = moment().subtract(4, 'days').format('YYYY-MM-DD');
|
||||
return Torrent.findAll({
|
||||
where: literal(`torrent."updatedAt" < \'${lastUpdate}\' AND torrent."createdAt" > \'${createdAfter}\'`),
|
||||
limit: limit,
|
||||
order: [
|
||||
['seeders', 'ASC'],
|
||||
['updatedAt', 'ASC']
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
function getNoContentsTorrents() {
|
||||
return Torrent.findAll({
|
||||
where: { opened: false, seeders: { [Op.gte]: 1 } },
|
||||
@@ -315,6 +328,7 @@ module.exports = {
|
||||
getTorrentsBasedOnQuery,
|
||||
deleteTorrent,
|
||||
getUpdateSeedersTorrents,
|
||||
getUpdateSeedersNewTorrents,
|
||||
getNoContentsTorrents,
|
||||
createFile,
|
||||
getFiles,
|
||||
|
||||
Reference in New Issue
Block a user