Using metadata configuration rather than item description for EXIF save. Fixed dissect duplicate detection failing for empty host.

This commit is contained in:
ThePendulum 2018-04-26 00:34:08 +02:00
parent 4134f08c13
commit f2052004df
2 changed files with 10 additions and 10 deletions

View File

@ -9,10 +9,14 @@ function curateSubmissions(submissions) {
return submissions.reduce((acc, submission, index) => {
const host = dissectLink(submission.url);
if(config.fetch.avoidDuplicates && processed.has(host.id)) {
console.log('\x1b[33m%s\x1b[0m', `Ignoring cross-post or repost '${submission.title}' - ${submission.url}`);
if(host) {
if(config.fetch.avoidDuplicates && processed.has(host.id)) {
console.log('\x1b[33m%s\x1b[0m', `Ignoring cross-post or repost '${submission.title}' - ${submission.url}`);
return acc;
return acc;
}
processed.add(host.id);
}
const curatedSubmission = {
@ -28,8 +32,6 @@ function curateSubmissions(submissions) {
host
};
processed.add(host.id);
return acc.concat(curatedSubmission);
}, []);
};

View File

@ -42,7 +42,7 @@ module.exports = function(posts, user) {
}).then(() => {
return save(filepath, item.stream);
}).then(() => {
const interpolatedMeta = Object.entries(config.library.meta).reduce((acc, [key, value]) => {
const meta = Object.entries(config.library.meta).reduce((acc, [key, value]) => {
const interpolatedValue = interpolate(value, user, post, item);
if(interpolatedValue) {
@ -52,10 +52,8 @@ module.exports = function(posts, user) {
return acc;
}, {});
if(Object.keys(interpolatedMeta).length > 0) {
return saveMeta(filepath, {
comment: item.description
}, ep);
if(Object.keys(meta).length > 0) {
return saveMeta(filepath, meta, ep);
}
});
}));