mirror of
https://github.com/kmein/niveum
synced 2026-03-16 18:21:07 +01:00
Replace all ${pkg}/bin/name patterns with:
- lib.getExe pkg (for main executables: curl, jq, gnused, ffmpeg, etc.)
- lib.getExe' pkg "name" (for specific binaries: coreutils, util-linux, etc.)
53 lines
1.2 KiB
Nix
53 lines
1.2 KiB
Nix
# Berlin BVG transit disruption checker
|
|
{
|
|
lib,
|
|
writers,
|
|
curl,
|
|
jq,
|
|
}:
|
|
writers.writeDashBin "bvg" ''
|
|
${lib.getExe curl} -sSL 'https://www.bvg.de/disruption-reports/q' \
|
|
--data-raw '{"variables":{},"query":"{
|
|
allDisruptions {
|
|
disruptions {
|
|
meldungsId
|
|
linie
|
|
verkehrsmittel
|
|
__typename
|
|
... on Traffic {
|
|
datum
|
|
gueltigVonDatum
|
|
gueltigVonZeit
|
|
gueltigBisDatum
|
|
gueltigBisZeit
|
|
richtungName
|
|
richtungHafasId
|
|
beginnAbschnittName
|
|
beginnAbschnittHafasId
|
|
endeAbschnittName
|
|
endeAbschnittHafasId
|
|
textIntUrsache
|
|
sev
|
|
textIntAuswirkung
|
|
umfahrung
|
|
textWAPSMSUrsache
|
|
textWAPSMSAuswirkung
|
|
prioritaet
|
|
__typename
|
|
}
|
|
}
|
|
__typename
|
|
}
|
|
}"}' \
|
|
| ${lib.getExe jq} --arg interesting "$interesting" '
|
|
.data.allDisruptions.disruptions
|
|
| map(select(
|
|
(.linie as $linie
|
|
| $interesting
|
|
| split(" ")
|
|
| index($linie))
|
|
and (.["__typename"] == "Traffic")
|
|
))
|
|
'
|
|
''
|