Don't request complete stop sequence
This commit is contained in:
parent
00abbcbb90
commit
723372238b
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
vrnp-static = pkgs.buildGoModule {
|
vrnp-static = pkgs.buildGoModule {
|
||||||
pname = "vrnp";
|
pname = "vrnp";
|
||||||
version = "0.0.3";
|
version = "0.0.4";
|
||||||
vendorHash = null;
|
vendorHash = null;
|
||||||
|
|
||||||
# For building the package, we use only the files not ignored by Git as inputs.
|
# For building the package, we use only the files not ignored by Git as inputs.
|
||||||
|
6
main.go
6
main.go
@ -54,7 +54,7 @@ func FetchDepartures(stopId string) (DMResponse, error) {
|
|||||||
query := url.Values{}
|
query := url.Values{}
|
||||||
query.Set("coordOutputFormat", "EPSG:4326")
|
query.Set("coordOutputFormat", "EPSG:4326")
|
||||||
query.Set("depType", "stopEvents")
|
query.Set("depType", "stopEvents")
|
||||||
query.Set("includeCompleteStopSeq", "1")
|
query.Set("includeCompleteStopSeq", "0")
|
||||||
query.Set("limit", "10")
|
query.Set("limit", "10")
|
||||||
query.Set("locationServerActive", "0")
|
query.Set("locationServerActive", "0")
|
||||||
query.Set("mode", "direct")
|
query.Set("mode", "direct")
|
||||||
@ -91,6 +91,7 @@ type Departures struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Departure struct {
|
type Departure struct {
|
||||||
|
Platform string `json:"platform"`
|
||||||
Symbol string `json:"symbol"`
|
Symbol string `json:"symbol"`
|
||||||
Direction string `json:"direction"`
|
Direction string `json:"direction"`
|
||||||
Leaving string `json:"leaving"`
|
Leaving string `json:"leaving"`
|
||||||
@ -101,6 +102,8 @@ func ParseDepartures(response DMResponse, allowedPlatform *string) (Departures,
|
|||||||
|
|
||||||
for _, d := range response.DepartureList {
|
for _, d := range response.DepartureList {
|
||||||
direction := d.ServingLine.Direction
|
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 {
|
if len(d.OnwardStopSeq) != 0 {
|
||||||
last := d.OnwardStopSeq[len(d.OnwardStopSeq)-1]
|
last := d.OnwardStopSeq[len(d.OnwardStopSeq)-1]
|
||||||
if slices.Contains([]string{"5", "6"}, last.PlaceID) {
|
if slices.Contains([]string{"5", "6"}, last.PlaceID) {
|
||||||
@ -130,6 +133,7 @@ func ParseDepartures(response DMResponse, allowedPlatform *string) (Departures,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ds = append(ds, Departure{
|
ds = append(ds, Departure{
|
||||||
|
d.Platform,
|
||||||
d.ServingLine.Symbol,
|
d.ServingLine.Symbol,
|
||||||
direction,
|
direction,
|
||||||
leaving,
|
leaving,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user