summaryrefslogtreecommitdiff
path: root/sfeed_update
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2021-01-25 19:27:04 +0100
committerHiltjo Posthuma <hiltjo@codemadness.org>2021-01-27 15:24:02 +0100
commit1a17ad48876172fadb6782f1edee2058819770dc (patch)
treede12972b279a76072d51839dd814df3e870ecdfe /sfeed_update
parent650adaf537c2baea0d8ad1d11d16286c798cd640 (diff)
sfeed_update: add an overridable parse() function, using sfeed(1) by default
This can be useful to make more cleanly make connector scripts. This does not necesarily even have to be in the sfeed(5) format.
Diffstat (limited to 'sfeed_update')
-rwxr-xr-xsfeed_update8
1 files changed, 7 insertions, 1 deletions
diff --git a/sfeed_update b/sfeed_update
index 3cf575c..ff9a44a 100755
--- a/sfeed_update
+++ b/sfeed_update
@@ -55,6 +55,12 @@ convertencoding() {
fi
}
+# parse and convert input, by default XML to the sfeed(5) TSV format.
+# parse(name, feedurl, basesiteurl)
+parse() {
+ sfeed "$3"
+}
+
# filter fields.
# filter(name)
filter() {
@@ -115,7 +121,7 @@ feed() {
fi
rm -f "${tmpfeedfile}.fetch"
- if ! sfeed "${basesiteurl}" < "${tmpfeedfile}.utf8" > "${tmpfeedfile}.tsv"; then
+ if ! parse "${name}" "${feedurl}" "${basesiteurl}" < "${tmpfeedfile}.utf8" > "${tmpfeedfile}.tsv"; then
log "${name}" "FAIL (CONVERT)"
return
fi