|
|
|
@ -13,7 +13,8 @@ import (
|
|
|
|
|
|
|
|
|
|
// SL is my SL struct
|
|
|
|
|
type SL struct {
|
|
|
|
|
Config *Config
|
|
|
|
|
Config *Config
|
|
|
|
|
lastResponse SLResponse
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// SLResponse is a struct to get the interesting data from API Responses
|
|
|
|
@ -54,11 +55,16 @@ func (sl *SL) GetOutput() string {
|
|
|
|
|
|
|
|
|
|
sldata, err := sl.getTimeTable()
|
|
|
|
|
|
|
|
|
|
// If no error occured, save the latest data to the struct
|
|
|
|
|
if err == nil {
|
|
|
|
|
sl.lastResponse = sldata
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.Fatal(err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for _, v := range sldata.ResponseData.Metros {
|
|
|
|
|
for _, v := range sl.lastResponse.ResponseData.Metros {
|
|
|
|
|
table.Append([]string{
|
|
|
|
|
v.LineNumber,
|
|
|
|
|
v.Destination,
|
|
|
|
|