Add CDF meta-feed

This commit is contained in:
Lucidiot 2021-03-21 15:48:57 +01:00
parent 8f47f99818
commit 70ef6b9e97
Signed by: lucidiot
GPG Key ID: 3358C1CA6906FB8D
4 changed files with 32 additions and 8 deletions

1
.gitignore vendored
View File

@ -1,5 +1,6 @@
feeds
feeds.opml
feeds.cdf
index.html
*~
*.sw[a-z]

17
bin/cdfmerge Executable file
View File

@ -0,0 +1,17 @@
#!/bin/bash
[ -z "$DIR" ] && DIR="$( cd "$(dirname "${BASH_SOURCE[0]}")/.." >/dev/null 2>&1 && pwd )"
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>
<CHANNEL LASTMOD=\"$(date --utc '+%Y-%m-%dT%H:%M')\">
<A HREF=\"http://tilde.town/~lucidiot/itsb/\"/>
<ABSTRACT>A project to make transport accident investigation reports easier to access.</ABSTRACT>
<TITLE>International Transport Safety Bureau</TITLE>
<LOGO HREF=\"http://tilde.town/~lucidiot/itsb/img/itsb.gif\" STYLE=\"ICON\"/>
<LOGO HREF=\"http://tilde.town/~lucidiot/itsb/img/itsb.gif\" STYLE=\"IMAGE\"/>" > "$DIR/feeds.cdf.new"
# Grab the paths to all generated CDF feeds from the XML in stdin
bin/xml2json | jq --raw-output --arg DIR "$DIR" '.. | objects | select(.["@format"] == "cdf") | "\($DIR)/feeds/\(.output // .link)"' | xargs tail -q -n+2 > "$DIR/feeds.cdf.new"
echo '</CHANNEL>' >> "$DIR/feeds.cdf.new"
mv "$DIR/feeds.cdf.new" "$DIR/feeds.cdf"

View File

@ -1,8 +1,13 @@
#!/bin/bash
[ -z "$DIR" ] && DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
xsltproc "$DIR/xslt/itsb.xsl" "$DIR/itsb.xml" \
| tee \
>(xsltproc "$DIR/xslt/opml.xsl" - > "$DIR/feeds.opml") \
>(xsltproc "$DIR/xslt/html.xsl" - > "$DIR/index.html") \
| xsltproc "$DIR/xslt/feedgen.xsl" - \
| DIR="$DIR" bash -s -- "$@"
tmpfile=$(mktemp /tmp/itsb.XXXXXXXXXX)
trap "rm \"$tmpfile\"" EXIT
xsltproc "$DIR/xslt/itsb.xsl" "$DIR/itsb.xml" > "$tmpfile"
xsltproc "$DIR/xslt/feedgen.xsl" "$tmpfile" | DIR="$DIR" bash -s -- "$@"
xsltproc "$DIR/xslt/opml.xsl" "$tmpfile" > "$DIR/feeds.opml"
xsltproc "$DIR/xslt/html.xsl" "$tmpfile" > "$DIR/index.html"
bin/cdfmerge < "$tmpfile"

View File

@ -14,8 +14,9 @@
<p>but hey, i can still browse webpages to find the reports&mdash;what if i parsed those pages?</p>
<p>this is the whole goal of this project; to centralize accident reports into manageable RSS feeds and maybe more formats later on.</p>
<p>
you can get all the feeds at once in one OPML file:
<a href="./feeds.opml" target="_blank"><img src="img/opml.gif" alt="OPML Feeds" /></a>
you can get all the feeds at once:
<a href="./feeds.opml" target="_blank"><img src="img/opml.gif" alt="OPML" /></a>
<a href="./feeds.cdf" target="_blank"><img src="img/cdf.gif" alt="CDF" /></a>
</p>
]]>
</content>