diff options
author | Case Duckworth | 2022-08-13 22:50:17 -0500 |
---|---|---|
committer | Case Duckworth | 2022-08-13 22:50:17 -0500 |
commit | 7bffb9e0da2bc196061a4559449d9f6d877886bf (patch) | |
tree | 68ce2af86ebf57c6fc8bdc94e8b3dc466f032bf8 /runsfeed | |
parent | Add noa's sotw (diff) | |
download | sfeed-7bffb9e0da2bc196061a4559449d9f6d877886bf.tar.gz sfeed-7bffb9e0da2bc196061a4559449d9f6d877886bf.zip |
Add weeds generation
Diffstat (limited to 'runsfeed')
-rwxr-xr-x | runsfeed | 18 |
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 | ||
152 | weed() ( | ||
153 | # Generate a page for weeds. | ||
154 | runcmd sfeed_update_xargs weedrc >&2 | ||
155 | . weedrc | ||
156 | aggregate "$sfeedpath" | runcmd sfeed_weed.awk | ||
157 | ) | ||
158 | |||
146 | archive() ( # sfeed_archive AGE FEED ... | 159 | archive() ( # 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 | ||