From 75e1d3aee4c1c5ba55d95cf9e14e39afb24879b1 Mon Sep 17 00:00:00 2001 From: embr Date: Tue, 26 Dec 2023 17:21:47 +0100 Subject: [PATCH] =?UTF-8?q?CZ=5FCD:=20Add=20support=20for=20=C4=8Cesk?= =?UTF-8?q?=C3=A9=20dr=C3=A1hy=20trains=20(and=20their=20cross-border=20EC?= =?UTF-8?q?s)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ambient.d/trains/CZ_CD.fish | 13 +++++++++++++ widgets.d/trains/CZ_CD.fish | 3 +++ 2 files changed, 16 insertions(+) create mode 100644 ambient.d/trains/CZ_CD.fish create mode 100644 widgets.d/trains/CZ_CD.fish diff --git a/ambient.d/trains/CZ_CD.fish b/ambient.d/trains/CZ_CD.fish new file mode 100644 index 0000000..671504c --- /dev/null +++ b/ambient.d/trains/CZ_CD.fish @@ -0,0 +1,13 @@ +ambient_is_ssid "CDWiFi"; or exit + +curl -s http://cdwifi.cz/portal/api/vehicle/realtime | jq -r '{ + "AMBIENT_CZ_CD_GPS_LAT": (.gpsLat), + "AMBIENT_CZ_CD_GPS_LNG": (.gpsLng), + "AMBIENT_CZ_CD_PREV_GPS_LAT": (.gpsLat), + "AMBIENT_CZ_CD_PREV_GPS_LNG": (.gpsLng), + "AMBIENT_CZ_CD_PREV_GPS_LNG": (.gpsLng), + "AMBIENT_CZ_CD_SPEED": (.speed), + "AMBIENT_CZ_CD_DELAY": (.delay), + "AMBIENT_CZ_CD_ALTITUDE": (.altitude), + "AMBIENT_CZ_CD_TEMPERATURE": (.temperature), +} | to_entries | map(select(.value != null)) | map(.key + "=" + (.value | tostring)) | join("\n")' diff --git a/widgets.d/trains/CZ_CD.fish b/widgets.d/trains/CZ_CD.fish new file mode 100644 index 0000000..4ec51f8 --- /dev/null +++ b/widgets.d/trains/CZ_CD.fish @@ -0,0 +1,3 @@ +if set -q AMBIENT_CZ_CD_SPEED + echo "💨 $AMBIENT_CZ_CD_SPEED km/h" +end