From 84cb64e84cec09f296eaa5de02f2925ba1453e73 Mon Sep 17 00:00:00 2001 From: DebaucheryLibrarian Date: Wed, 11 Sep 2024 05:16:54 +0200 Subject: [PATCH] Using metadata configuration rather than item description for EXIF save. Fixed dissect duplicate detection failing for empty host. --- src/curate/submissions.js | 12 +++++++----- src/fetch/content.js | 8 +++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/curate/submissions.js b/src/curate/submissions.js index 83b322b..0455c61 100644 --- a/src/curate/submissions.js +++ b/src/curate/submissions.js @@ -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); }, []); }; diff --git a/src/fetch/content.js b/src/fetch/content.js index c110533..29c8e56 100644 --- a/src/fetch/content.js +++ b/src/fetch/content.js @@ -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); } }); }));