about summary refs log tree commit diff stats
path: root/runsfeed
diff options
context:
space:
mode:
authorCase Duckworth2022-08-13 22:50:17 -0500
committerCase Duckworth2022-08-13 22:50:17 -0500
commit7bffb9e0da2bc196061a4559449d9f6d877886bf (patch)
tree68ce2af86ebf57c6fc8bdc94e8b3dc466f032bf8 /runsfeed
parentAdd noa's sotw (diff)
downloadsfeed-7bffb9e0da2bc196061a4559449d9f6d877886bf.tar.gz
sfeed-7bffb9e0da2bc196061a4559449d9f6d877886bf.zip
Add weeds generation
Diffstat (limited to 'runsfeed')
-rwxr-xr-xrunsfeed18
1 files changed, 16 insertions, 2 deletions
diff --git a/runsfeed b/runsfeed index 90c128d..043723c 100755 --- a/runsfeed +++ b/runsfeed
@@ -59,6 +59,12 @@ main() {
59 }' 59 }'
60 logok "Archiving old feeds" \ 60 logok "Archiving old feeds" \
61 'archive 60 "$sfeedpath"/*' 61 'archive 60 "$sfeedpath"/*'
62 logok "Weeding" '{
63 echo
64 mkdir -p "$SFEED_OUTPUT/weeds";
65 weed > /tmp/weeds.html &&
66 mv /tmp/weeds.html "$SFEED_OUTPUT/weeds/index.html";
67 }'
62 if [ -f /tmp/runsfeed.ok ]; then 68 if [ -f /tmp/runsfeed.ok ]; then
63 echo >&2 'Done.' 69 echo >&2 'Done.'
64 else 70 else
@@ -143,16 +149,24 @@ atom() ( # atom DIRECTORY [DAYS]
143 aggregate "$1" "$2" | sfeed_atom 149 aggregate "$1" "$2" | sfeed_atom
144) 150)
145 151
152weed() (
153 # Generate a page for weeds.
154 runcmd sfeed_update_xargs weedrc >&2
155 . weedrc
156 aggregate "$sfeedpath" | runcmd sfeed_weed.awk
157)
158
146archive() ( # sfeed_archive AGE FEED ... 159archive() ( # sfeed_archive AGE FEED ...
147 age="$1" 160 age="$1"
148 shift 161 shift
162 # shellcheck disable=2031
149 old="$sfeedpath/../sfeed.old.d" 163 old="$sfeedpath/../sfeed.old.d"
150 mkdir -p "$old" 164 mkdir -p "$old"
151 for feed; do 165 for feed; do
152 awk -v old="$(($(date +%s) - (age * 24 * 3600)))" \ 166 awk -v old="$(($(date +%s) - (age * 24 * 3600)))" \
153 -F '\t' 'int($1) > old' <"$feed" >"$feed.new" 167 -F '\t' 'int($1) > old' <"$feed" >"$feed.new"
154 mv "$feed" "$old/${feed##*/}" && 168 mv "$feed" "$old/${feed##*/}" 2>/dev/null &&
155 mv "$feed.new" "$feed" 169 mv "$feed.new" "$feed" 2>/dev/null
156 done 170 done
157) 171)
158 172