2023-08-06 21:01:13 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2023-08-18 15:04:56 +00:00
|
|
|
"fmt"
|
2023-08-06 21:01:13 +00:00
|
|
|
"net/http"
|
2023-08-18 15:04:56 +00:00
|
|
|
"net/url"
|
2023-08-06 21:01:13 +00:00
|
|
|
)
|
|
|
|
|
2023-08-06 21:18:47 +00:00
|
|
|
type Route struct {
|
|
|
|
RouteShortName string `json:"route_short_name"`
|
|
|
|
RouteLongName string `json:"route_long_name"`
|
|
|
|
}
|
|
|
|
|
2023-08-06 21:01:13 +00:00
|
|
|
type Quay struct {
|
2023-08-06 21:18:47 +00:00
|
|
|
ID string `json:"quayid"`
|
|
|
|
Name string `json:"name"`
|
|
|
|
Town string `json:"town"`
|
|
|
|
RoutesOfInterest []Route
|
|
|
|
}
|
|
|
|
|
|
|
|
func (q Quay) IsInterestingDeparture(d Departure) bool {
|
|
|
|
for _, route := range q.RoutesOfInterest {
|
|
|
|
if (route.RouteShortName == d.RouteShortName) && (route.RouteLongName == d.StopHeadsign) {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false
|
2023-08-06 21:01:13 +00:00
|
|
|
}
|
|
|
|
|
2023-08-18 15:04:56 +00:00
|
|
|
func (q Quay) GetBrengUrl() string {
|
|
|
|
param := fmt.Sprintf("{\"quayid\":\"%s\",\"name\":\"%s\",\"town\":\"%s\"}", q.ID, q.Name, q.Town)
|
|
|
|
return fmt.Sprint("https://www.breng.nl/nl/resultaten/halte-informatie/?stop=%s", url.QueryEscape(param))
|
|
|
|
}
|
|
|
|
|
2023-08-06 21:01:13 +00:00
|
|
|
var BusClient *http.Client
|
|
|
|
var Quays []Quay = []Quay{}
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
BusClient = &http.Client{}
|
|
|
|
serveHttp()
|
|
|
|
}
|