Added missing-date as config and argument alias.

This commit is contained in:
DebaucheryLibrarian 2020-10-20 00:05:23 +02:00
parent 4a900cbbeb
commit 2f8fca0327
3 changed files with 5 additions and 5 deletions

View File

@ -189,7 +189,7 @@ module.exports = {
], ],
}, },
fetchAfter: [1, 'week'], fetchAfter: [1, 'week'],
noDateLimit: 3, missingDateLimit: 3,
media: { media: {
path: './media', path: './media',
thumbnailSize: 320, // width for 16:9 will be exactly 576px thumbnailSize: 320, // width for 16:9 will be exactly 576px

View File

@ -142,11 +142,11 @@ const { argv } = yargs
describe: 'Get the latest x releases, no matter the date range', describe: 'Get the latest x releases, no matter the date range',
type: 'number', type: 'number',
}) })
.option('no-date-limit', { .option('missing-date-limit', {
describe: 'Limit amount of scenes when dates are missing.', describe: 'Limit amount of scenes when dates are missing.',
type: 'number', type: 'number',
default: config.noDateLimit, default: config.noDateLimit,
alias: ['null-date-limit', 'limit'], alias: ['no-date-limit', 'null-date-limit', 'limit'],
}) })
.option('page', { .option('page', {
describe: 'Page to start scraping at', describe: 'Page to start scraping at',

View File

@ -73,7 +73,7 @@ function needNextPage(pageReleases, accReleases, isUpcoming) {
} }
if (!pageReleases.every(release => !!release.date)) { // some scenes don't have dates 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) { 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))) const limitedReleases = (argv.last && releases.slice(0, Math.max(argv.last, 0)))
|| (hasDates && releases.filter(release => moment(release.date).isAfter(argv.after))) || (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 const { uniqueReleases, duplicateReleases } = argv.force
? { uniqueReleases: limitedReleases, duplicateReleases: [] } ? { uniqueReleases: limitedReleases, duplicateReleases: [] }