From 126e78123d48733f42bb6b2e367773183bb80922 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Wed, 20 Jul 2022 12:07:34 -0500 Subject: Order twtxt feeds --- runsfeed | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'runsfeed') diff --git a/runsfeed b/runsfeed index 07df1e5..62072d8 100755 --- a/runsfeed +++ b/runsfeed @@ -50,7 +50,7 @@ main() { mv /tmp/feeds.opml "$SFEED_OUTPUT/feeds.opml"; }' logok "Generating twtxt" '{ - twtxt "$sfeedpath"/* >/tmp/feeds.txt && + twtxt "$sfeedpath" >/tmp/feeds.txt && mv /tmp/feeds.txt "$SFEED_OUTPUT/feeds.txt"; }' # logok "Archiving old feeds" \ @@ -107,7 +107,18 @@ update() { } twtxt() { - sfeed_twtxt "$@" + curd="$PWD" + cd "$1" || return 1 + if [ $# -eq 2 ]; then + old="$(($(date +%s) - ($2 * 24 * 3600)))" + else + old=0 + fi + awk -v old="$old" \ + 'BEGIN{FS="\t";OFS="\t";} int($1)>=old{$2="["FILENAME"] "$2;print}' \ + * | + sort -k1,1rn | + sfeed_twtxt } opml() { -- cgit 1.4.1-21-gabe81