From 7bffb9e0da2bc196061a4559449d9f6d877886bf Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Sat, 13 Aug 2022 22:50:17 -0500 Subject: Add weeds generation --- runsfeed | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'runsfeed') diff --git a/runsfeed b/runsfeed index 90c128d..043723c 100755 --- a/runsfeed +++ b/runsfeed @@ -59,6 +59,12 @@ main() { }' logok "Archiving old feeds" \ 'archive 60 "$sfeedpath"/*' + logok "Weeding" '{ + echo + mkdir -p "$SFEED_OUTPUT/weeds"; + weed > /tmp/weeds.html && + mv /tmp/weeds.html "$SFEED_OUTPUT/weeds/index.html"; + }' if [ -f /tmp/runsfeed.ok ]; then echo >&2 'Done.' else @@ -143,16 +149,24 @@ atom() ( # atom DIRECTORY [DAYS] aggregate "$1" "$2" | sfeed_atom ) +weed() ( + # Generate a page for weeds. + runcmd sfeed_update_xargs weedrc >&2 + . weedrc + aggregate "$sfeedpath" | runcmd sfeed_weed.awk +) + archive() ( # sfeed_archive AGE FEED ... age="$1" shift + # shellcheck disable=2031 old="$sfeedpath/../sfeed.old.d" mkdir -p "$old" for feed; do awk -v old="$(($(date +%s) - (age * 24 * 3600)))" \ -F '\t' 'int($1) > old' <"$feed" >"$feed.new" - mv "$feed" "$old/${feed##*/}" && - mv "$feed.new" "$feed" + mv "$feed" "$old/${feed##*/}" 2>/dev/null && + mv "$feed.new" "$feed" 2>/dev/null done ) -- cgit 1.4.1-21-gabe81