Added after/before-index alias for after/before-indexed

This commit is contained in:
ThePendulum 2018-07-08 00:18:51 +02:00
parent e7af52bc01
commit aa1c612306
3 changed files with 27 additions and 22 deletions

View File

@ -58,10 +58,12 @@ function getArgs() {
describe: 'Only include posts before this date (YYYY-MM-DD, optionally HH:mm)', describe: 'Only include posts before this date (YYYY-MM-DD, optionally HH:mm)',
}) })
.option('after-indexed', { .option('after-indexed', {
alias: 'after-index',
describe: 'Only include posts after the oldest or the latest entry in the index', describe: 'Only include posts after the oldest or the latest entry in the index',
choices: ['oldest', 'latest'], choices: ['oldest', 'latest'],
}) })
.option('before-indexed', { .option('before-indexed', {
alias: 'before-index',
describe: 'Only include posts before the oldest or the latest entry in the index', describe: 'Only include posts before the oldest or the latest entry in the index',
choices: ['oldest', 'latest'], choices: ['oldest', 'latest'],
}) })

View File

@ -62,7 +62,7 @@ async function fetchSaveContent(user, ep, args) {
const streams = await getStreams(item, post); const streams = await getStreams(item, post);
// no streams, ignore item // no streams, ignore item
if (!streams || streams.length <= 0) { if (!streams || streams.length === 0) {
return accItems; return accItems;
} }

View File

@ -1,12 +1,14 @@
'use strict'; 'use strict';
const util = require('util');
const config = require('config'); const config = require('config');
const Promise = require('bluebird'); const Promise = require('bluebird');
const methods = require('../methods/methods.js'); const methods = require('../methods/methods.js');
const attachContentInfo = users => { const attachContentInfo = users => Promise.reduce(Object.values(users), async (accUsers, user) => ({
return Promise.reduce(Object.values(users), async (accUsers, user) => ({...accUsers, [user.name]: {...user, posts: await Promise.reduce(user.posts, async (accPosts, post) => { ...accUsers,
[user.name]: {
...user,
posts: await Promise.reduce(user.posts, async (accPosts, post) => {
if (!post.host || !methods[post.host.method]) { if (!post.host || !methods[post.host.method]) {
console.log('\x1b[33m%s\x1b[0m', `Ignoring unsupported content '${post.url}' (${post.permalink})`); console.log('\x1b[33m%s\x1b[0m', `Ignoring unsupported content '${post.url}' (${post.permalink})`);
@ -26,7 +28,8 @@ const attachContentInfo = users => {
return accPosts; return accPosts;
} }
}, [])}}), {}); }, []),
}; },
}), {});
module.exports = attachContentInfo; module.exports = attachContentInfo;