diff --git a/cmd/departures.go b/cmd/departures.go index 6f81af5..4afd7a5 100644 --- a/cmd/departures.go +++ b/cmd/departures.go @@ -56,7 +56,11 @@ func departures(cmd *cobra.Command, args []string) error { } for _, departure := range departures { - fmt.Printf("%s %s %s\n", departure.RouteID, departure.Time, departure.Headsign) + line := fmt.Sprintf("%s %s %s", departure.RouteID, departure.Time, departure.Headsign) + if departure.Delay != 0 { + line += fmt.Sprintf(" (%s)", departure.Delay) + } + fmt.Println(line) } return nil diff --git a/downloader/downloader.go b/downloader/downloader.go index 11ca976..456425e 100644 --- a/downloader/downloader.go +++ b/downloader/downloader.go @@ -47,8 +47,6 @@ func HTTPGet(ctx context.Context, url string, headers map[string]string, options defer resp.Body.Close() - fmt.Println("status", resp.StatusCode) - var reader io.Reader = resp.Body if options.MaxSize > 0 { reader = io.LimitReader(resp.Body, int64(options.MaxSize)) diff --git a/realtime.go b/realtime.go index df94734..a58b5cc 100644 --- a/realtime.go +++ b/realtime.go @@ -190,6 +190,7 @@ func (rt *Realtime) Departures( case parse.StopTimeUpdateScheduled: // SCHEDULED => update to static schedule dep.Time = dep.Time.Add(updates[idx].DepartureDelay) + dep.Delay = updates[idx].DepartureDelay departures = append(departures, dep) } } diff --git a/static.go b/static.go index 4aa397f..1734dc8 100644 --- a/static.go +++ b/static.go @@ -89,6 +89,7 @@ type Departure struct { DirectionID int8 Time time.Time Headsign string + Delay time.Duration } // Translates a time offset into a GTFS style HHMMSS string.