From 0685bdac524d2c983c31733172dd1b7138fd5915 Mon Sep 17 00:00:00 2001 From: Lucidiot Date: Fri, 19 Mar 2021 20:53:56 +0100 Subject: [PATCH] Add OEAIF feeds, close #41 --- itsb.xml | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++ jq/oeaif.jq | 41 ++++++++++++++++++++++++++++++++++ 2 files changed, 104 insertions(+) create mode 100644 jq/oeaif.jq diff --git a/itsb.xml b/itsb.xml index 8127063..1f78e74 100644 --- a/itsb.xml +++ b/itsb.xml @@ -1064,5 +1064,68 @@ ie-raiu.xml + + + Organisme d'EnquĂȘte sur les Accidents et Incidents Ferroviaires + Belgium + Rail + 3 reports/year + + + https://www.rail-investigation.be/wp-admin/admin-ajax.php + action=filtreEnquete&data[0][name]=enquete_etat&data[0][value]=125 +
wp-wpml_current_language=fr
+
+ tr + + OEAIF + fr + + + oeaif/fr.xml +
+ + + https://www.rail-investigation.be/wp-admin/admin-ajax.php + action=filtreEnquete&data[0][name]=enquete_etat&data[0][value]=125 +
wp-wpml_current_language=nl
+
+ tr + + OOIS + nl + + + oeaif/nl.xml +
+ + + https://www.rail-investigation.be/wp-admin/admin-ajax.php + action=filtreEnquete&data[0][name]=enquete_etat&data[0][value]=125 +
wp-wpml_current_language=en
+
+ tr + + RAIIU + en + + + oeaif/en.xml +
+ + + https://www.rail-investigation.be/wp-admin/admin-ajax.php + action=filtreEnquete&data[0][name]=enquete_etat&data[0][value]=125 +
wp-wpml_current_language=de
+
+ tr + + UfE + de + + + oeaif/de.xml +
+ diff --git a/jq/oeaif.jq b/jq/oeaif.jq new file mode 100644 index 0000000..f0ab6fe --- /dev/null +++ b/jq/oeaif.jq @@ -0,0 +1,41 @@ +# OEAIF feed generator +# Expects pup JSON output holding tags, outputs xmltodict-compatible JSON +# WARNING: Dates are locale-sensitive; the RSS feed might not generate correctly with another locale. +# Expected variables: +# $title: Title of the feed +# $lang: Language code, without the country code (fr/en/nl/de) + +{ + "rss": { + "@version": "2.0", + "channel": { + "title": $title, + "description": $title, + "link": "https://www.rail-investigation.be/\($lang)/", + "language": "\($lang)-BE", + "pubDate": (now | strftime("%a, %d %b %Y %T %z")), + "docs": "https://www.rssboard.org/rss-specification", + "ttl": 1440, + "generator": "ITSB", + "item": [.[] | { + "title": .children[2].text, + "description": ( + [ + ([.children[1]] + .children[3:])[] + | (.["data-title"] + ": " + .text) + ] + | join("
  • ") + | "" + ), + "link": .["data-href"], + "guid": .["data-href"], + "pubDate": ( + .children[0].text + | strptime("%d/%m/%Y") + | mktime + | strftime("%a, %d %b %Y %T %z") + ) + }] + } + } +}