From 723372238bf6aaeb378c276f0c95a637b12b880f Mon Sep 17 00:00:00 2001 From: Paul Brinkmeier Date: Wed, 23 Apr 2025 12:01:34 +0200 Subject: [PATCH] Don't request complete stop sequence --- flake.nix | 2 +- main.go | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index cf3f369..912a63f 100644 --- a/flake.nix +++ b/flake.nix @@ -16,7 +16,7 @@ vrnp-static = pkgs.buildGoModule { pname = "vrnp"; - version = "0.0.3"; + version = "0.0.4"; vendorHash = null; # For building the package, we use only the files not ignored by Git as inputs. diff --git a/main.go b/main.go index 7bfec15..6c1ba74 100644 --- a/main.go +++ b/main.go @@ -54,7 +54,7 @@ func FetchDepartures(stopId string) (DMResponse, error) { query := url.Values{} query.Set("coordOutputFormat", "EPSG:4326") query.Set("depType", "stopEvents") - query.Set("includeCompleteStopSeq", "1") + query.Set("includeCompleteStopSeq", "0") query.Set("limit", "10") query.Set("locationServerActive", "0") query.Set("mode", "direct") @@ -91,6 +91,7 @@ type Departures struct { } type Departure struct { + Platform string `json:"platform"` Symbol string `json:"symbol"` Direction string `json:"direction"` Leaving string `json:"leaving"` @@ -101,6 +102,8 @@ func ParseDepartures(response DMResponse, allowedPlatform *string) (Departures, for _, d := range response.DepartureList { direction := d.ServingLine.Direction + // If available, use name of last stop as direction + // Note that OnwardStopSeq is only populated if includeCompleteStopSeq=1 is set. if len(d.OnwardStopSeq) != 0 { last := d.OnwardStopSeq[len(d.OnwardStopSeq)-1] if slices.Contains([]string{"5", "6"}, last.PlaceID) { @@ -130,6 +133,7 @@ func ParseDepartures(response DMResponse, allowedPlatform *string) (Departures, } ds = append(ds, Departure{ + d.Platform, d.ServingLine.Symbol, direction, leaving,