sfeed

Simple RSS and Atom feed parser
git clone https://git.sinitax.com/codemadness/sfeed
Log | Files | Refs | README | LICENSE | Upstream | sfeed.txt

commit 1b3f13b1ba5a3e40d4c9266f16091ad347aec333
parent f1883579dfcb256b514defcece7bf88fe65ee659
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Mon, 25 Jan 2021 19:30:21 +0100

sfeed_update: shuffle code getting the path of the feedurl to make the basesiteurl

Move it closer before it is used.

Diffstat:
Msfeed_update | 12++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/sfeed_update b/sfeed_update @@ -94,12 +94,6 @@ feed() { basesiteurl="$3" encoding="$4" - # if baseurl is empty then use the path from the feed by default. - if [ "${basesiteurl}" = "" ]; then - host="${feedurl##*://}" - basesiteurl="${feedurl%%://*}://${host%/*}/" - fi - filename="$(printf '%s' "${name}" | tr '/' '_')" sfeedfile="${sfeedpath}/${filename}" tmpfeedfile="${sfeedtmpdir}/${filename}" @@ -121,6 +115,12 @@ feed() { fi rm -f "${tmpfeedfile}.fetch" + # if baseurl is empty then use the path from the feed by default. + if [ "${basesiteurl}" = "" ]; then + host="${feedurl##*://}" + basesiteurl="${feedurl%%://*}://${host%/*}/" + fi + if ! parse "${name}" "${feedurl}" "${basesiteurl}" < "${tmpfeedfile}.utf8" > "${tmpfeedfile}.tsv"; then log "${name}" "FAIL (PARSE)" return