Added post score to index and variables.

This commit is contained in:
DebaucheryLibrarian 2024-09-11 05:16:57 +02:00
parent 12268fcb05
commit 60973a0e70
3 changed files with 4 additions and 1 deletions

View File

@ -61,6 +61,7 @@ function curatePost(acc, post, user, index, indexed, ignoreIds, processed, args)
url: post.url, url: post.url,
datetime: new Date(post.created_utc * 1000), datetime: new Date(post.created_utc * 1000),
subreddit: post.subreddit.display_name, subreddit: post.subreddit.display_name,
score: post.score,
preview: post.preview ? post.preview.images.map(image => image.source) : null, preview: post.preview ? post.preview.images.map(image => image.source) : null,
host, host,
hash: hashPost(post), hash: hashPost(post),

View File

@ -41,6 +41,7 @@ function interpolate(pattern, user, post, item, strip = true, dateFormat = confi
$postIndex: post.index + config.library.indexOffset, $postIndex: post.index + config.library.indexOffset,
$postHash: post.hash, $postHash: post.hash,
$url: post.url, $url: post.url,
$score: post.score,
$subreddit: post.subreddit, $subreddit: post.subreddit,
$hostLabel: post.host.label, $hostLabel: post.host.label,
$hostId: post.host.id, $hostId: post.host.id,

View File

@ -20,6 +20,7 @@ async function writeToIndex(posts, profilePaths, user, args) {
hostId: post.host.id, hostId: post.host.id,
date: post.datetime, date: post.datetime,
indexed: now, indexed: now,
score: post.score,
title: post.title, title: post.title,
}; };
@ -39,7 +40,7 @@ async function writeToIndex(posts, profilePaths, user, args) {
}; };
if (!data.profile.image && !data.profile.description && !data.posts.length) { if (!data.profile.image && !data.profile.description && !data.posts.length) {
return; return false;
} }
return save(filepath, textToStream(yaml.safeDump(data))); return save(filepath, textToStream(yaml.safeDump(data)));