Compare commits
3 Commits
d8e1711ce7
...
8df1ac94b5
Author | SHA1 | Date |
---|---|---|
Jasper Bok | 8df1ac94b5 | |
Jasper Bok | be4b6d8aa2 | |
Jasper Bok | 30db593e2a |
10
TODO
10
TODO
|
@ -2,19 +2,19 @@
|
||||||
|
|
||||||
## 1.0.0
|
## 1.0.0
|
||||||
|
|
||||||
|
[ ] *** Show max two departures per line per stop.
|
||||||
|
[ ] *** Read route preferences from env/config.
|
||||||
|
[ ] *.. Make the stop name link to Breng's page for that stop.
|
||||||
|
[ ] *.. Make the route name link to Breng's page for that route.
|
||||||
[x] *.. Print times in human-readable format.
|
[x] *.. Print times in human-readable format.
|
||||||
[x] **. Always parse times in Dutch timezone.
|
[x] **. Always parse times in Dutch timezone.
|
||||||
[x] *.. Show max three departures per stop.
|
[x] *.. Show max three departures per stop.
|
||||||
[ ] *** Show max two departures per line per stop.
|
|
||||||
[x] **. Add Connexxion departures.
|
[x] **. Add Connexxion departures.
|
||||||
[x] **. Make the page look nice (also on mobile).
|
[x] **. Make the page look nice (also on mobile).
|
||||||
[x] **. Add a favicon.
|
[x] **. Add a favicon.
|
||||||
[ ] *.. Add robots.txt.
|
|
||||||
[x] *.. Compile static files into the binary.
|
[x] *.. Compile static files into the binary.
|
||||||
[ ] *** Read route preferences from env/config.
|
|
||||||
[x] *.. Make the port configurable via CLI option.
|
[x] *.. Make the port configurable via CLI option.
|
||||||
[ ] *.. Make the stop name link to Breng's page for that stop.
|
[x] *.. Add robots.txt.
|
||||||
[ ] *.. Make the route name link to Breng's page for that route.
|
|
||||||
|
|
||||||
## Backlog
|
## Backlog
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<meta name="robots" content="noindex">
|
||||||
|
|
||||||
<link rel="icon" type="img/png" href="/static/img/bus16x16.png" sizes="16x16">
|
<link rel="icon" type="img/png" href="/static/img/bus16x16.png" sizes="16x16">
|
||||||
<link rel="icon" type="img/png" href="/static/img/bus32x32.png" sizes="32x32">
|
<link rel="icon" type="img/png" href="/static/img/bus32x32.png" sizes="32x32">
|
||||||
|
|
29
main.go
29
main.go
|
@ -2,38 +2,9 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Route struct {
|
|
||||||
RouteShortName string `json:"route_short_name"`
|
|
||||||
RouteLongName string `json:"route_long_name"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type Quay struct {
|
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
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))
|
|
||||||
}
|
|
||||||
|
|
||||||
var BusClient *http.Client
|
var BusClient *http.Client
|
||||||
var Quays []Quay = []Quay{}
|
var Quays []Quay = []Quay{}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"net/url"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Quay struct {
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
func (q Quay) GetBrengUrl() string {
|
||||||
|
param := fmt.Sprintf("{\"quayid\":\"%s\",\"name\":\"%s\",\"town\":\"%s\"}", q.ID, q.Name, q.Town)
|
||||||
|
return fmt.Sprintf("https://www.breng.nl/nl/resultaten/halte-informatie/?stop=%s", url.QueryEscape(param))
|
||||||
|
}
|
Loading…
Reference in New Issue