Added missing-date as config and argument alias.
This commit is contained in:
parent
4a900cbbeb
commit
2f8fca0327
|
@ -189,7 +189,7 @@ module.exports = {
|
|||
],
|
||||
},
|
||||
fetchAfter: [1, 'week'],
|
||||
noDateLimit: 3,
|
||||
missingDateLimit: 3,
|
||||
media: {
|
||||
path: './media',
|
||||
thumbnailSize: 320, // width for 16:9 will be exactly 576px
|
||||
|
|
|
@ -142,11 +142,11 @@ const { argv } = yargs
|
|||
describe: 'Get the latest x releases, no matter the date range',
|
||||
type: 'number',
|
||||
})
|
||||
.option('no-date-limit', {
|
||||
.option('missing-date-limit', {
|
||||
describe: 'Limit amount of scenes when dates are missing.',
|
||||
type: 'number',
|
||||
default: config.noDateLimit,
|
||||
alias: ['null-date-limit', 'limit'],
|
||||
alias: ['no-date-limit', 'null-date-limit', 'limit'],
|
||||
})
|
||||
.option('page', {
|
||||
describe: 'Page to start scraping at',
|
||||
|
|
|
@ -73,7 +73,7 @@ function needNextPage(pageReleases, accReleases, isUpcoming) {
|
|||
}
|
||||
|
||||
if (!pageReleases.every(release => !!release.date)) { // some scenes don't have dates
|
||||
return accReleases.length + pageReleases.length < argv.noDateLimit;
|
||||
return accReleases.length + pageReleases.length < argv.missingDateLimit;
|
||||
}
|
||||
|
||||
if (argv.after) {
|
||||
|
@ -117,7 +117,7 @@ async function scrapeReleases(scraper, entity, preData, isUpcoming) {
|
|||
|
||||
const limitedReleases = (argv.last && releases.slice(0, Math.max(argv.last, 0)))
|
||||
|| (hasDates && releases.filter(release => moment(release.date).isAfter(argv.after)))
|
||||
|| releases.slice(0, Math.max(argv.noDateLimit, 0));
|
||||
|| releases.slice(0, Math.max(argv.missingDateLimit, 0));
|
||||
|
||||
const { uniqueReleases, duplicateReleases } = argv.force
|
||||
? { uniqueReleases: limitedReleases, duplicateReleases: [] }
|
||||
|
|
Loading…
Reference in New Issue