Using metadata configuration rather than item description for EXIF save. Fixed dissect duplicate detection failing for empty host.
This commit is contained in:
parent
5c9f57f66c
commit
84cb64e84c
|
@ -9,12 +9,16 @@ function curateSubmissions(submissions) {
|
||||||
return submissions.reduce((acc, submission, index) => {
|
return submissions.reduce((acc, submission, index) => {
|
||||||
const host = dissectLink(submission.url);
|
const host = dissectLink(submission.url);
|
||||||
|
|
||||||
|
if(host) {
|
||||||
if(config.fetch.avoidDuplicates && processed.has(host.id)) {
|
if(config.fetch.avoidDuplicates && processed.has(host.id)) {
|
||||||
console.log('\x1b[33m%s\x1b[0m', `Ignoring cross-post or repost '${submission.title}' - ${submission.url}`);
|
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 = {
|
const curatedSubmission = {
|
||||||
id: submission.id,
|
id: submission.id,
|
||||||
index: index,
|
index: index,
|
||||||
|
@ -28,8 +32,6 @@ function curateSubmissions(submissions) {
|
||||||
host
|
host
|
||||||
};
|
};
|
||||||
|
|
||||||
processed.add(host.id);
|
|
||||||
|
|
||||||
return acc.concat(curatedSubmission);
|
return acc.concat(curatedSubmission);
|
||||||
}, []);
|
}, []);
|
||||||
};
|
};
|
||||||
|
|
|
@ -42,7 +42,7 @@ module.exports = function(posts, user) {
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
return save(filepath, item.stream);
|
return save(filepath, item.stream);
|
||||||
}).then(() => {
|
}).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);
|
const interpolatedValue = interpolate(value, user, post, item);
|
||||||
|
|
||||||
if(interpolatedValue) {
|
if(interpolatedValue) {
|
||||||
|
@ -52,10 +52,8 @@ module.exports = function(posts, user) {
|
||||||
return acc;
|
return acc;
|
||||||
}, {});
|
}, {});
|
||||||
|
|
||||||
if(Object.keys(interpolatedMeta).length > 0) {
|
if(Object.keys(meta).length > 0) {
|
||||||
return saveMeta(filepath, {
|
return saveMeta(filepath, meta, ep);
|
||||||
comment: item.description
|
|
||||||
}, ep);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
|
Loading…
Reference in New Issue