Author: Adam Evyčędo <git@apiote.xyz>
filter by platform in Berlin realtime
traffic/berlin_vbb.go | 14 ++++++++++++--
diff --git a/traffic/berlin_vbb.go b/traffic/berlin_vbb.go index f65d108dddb26683dd5ac870ebef1420632d5245..453d7f114449eece4a9f712f71ba9e17e2c23748 100644 --- a/traffic/berlin_vbb.go +++ b/traffic/berlin_vbb.go @@ -76,6 +76,16 @@ end i = i+1 end + platform = "" + i = 0 + for m in string.gmatch(stopID, "([^_]+)") do + if i == 2 then + platform = m + break + end + i = i+1 + end + response, error_message = http.get("https://v6.vbb.transport.rest/stops/" .. ibnr .. "/departures", { query="duration=30&results=24&pretty=false", timeout="30s" @@ -130,7 +140,7 @@ end i = i+1 end - if stationIBNR == ibnr then + if stationIBNR == ibnr and entry.platform == platform then updates.updates[entry.tripId] = { time=string.sub(entry.when, 12, 13) .. string.sub(entry.when, 15, 16) .. string.sub(entry.when, 18, 19), stopID=stopID, @@ -172,7 +182,7 @@ func (BerlinVbb) Flags() FeedFlags { return FeedFlags{ Headsign: HeadsignTripHeadsing, - StopIdFormat: "{{stop_id}}", + StopIdFormat: "{{stop_id}}_{{platform_code}}", StopName: "{{stop_name}} | {{platform_code}}", // TODO platform_code might not be present, but currently templating doesn’t support this LineName: "{{route_short_name}}", }