From 96d7afc7d7511f05ba07c5acbb5bbfb2847bc126 Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Fri, 9 Jun 2023 14:40:40 +0200 Subject: sfeed_update/sfeedrc: add url as parameter to the filter() and order() function This might make it easier to set filters or ordering by pattern matching on a group of feeds by the feed URL. For example youtube or reddit feeds. Another way which was already possible is prefixing names with for example: "reddit somename" or "yt somename". --- sfeed_update | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'sfeed_update') diff --git a/sfeed_update b/sfeed_update index 3da45d3..dadea9b 100755 --- a/sfeed_update +++ b/sfeed_update @@ -71,7 +71,7 @@ parse() { } # filter fields. -# filter(name) +# filter(name, url) filter() { cat } @@ -83,7 +83,7 @@ merge() { } # order by timestamp (descending). -# order(name) +# order(name, url) order() { sort -t ' ' -k1rn,1 } @@ -124,7 +124,7 @@ _feed() { fi rm -f "${tmpfeedfile}.utf8" - if ! filter "${name}" < "${tmpfeedfile}.tsv" > "${tmpfeedfile}.filter"; then + if ! filter "${name}" "${feedurl}" < "${tmpfeedfile}.tsv" > "${tmpfeedfile}.filter"; then log_error "${name}" "FAIL (FILTER)" return 1 fi @@ -142,7 +142,7 @@ _feed() { fi rm -f "${tmpfeedfile}.filter" - if ! order "${name}" < "${tmpfeedfile}.merge" > "${tmpfeedfile}.order"; then + if ! order "${name}" "${feedurl}" < "${tmpfeedfile}.merge" > "${tmpfeedfile}.order"; then log_error "${name}" "FAIL (ORDER)" return 1 fi -- cgit v1.2.3