|
@@ -82,29 +82,27 @@ type feedConverter struct {
|
|
|
|
|
|
Timezone *time.Location
|
|
|
TrafficCalendarFile *os.File
|
|
|
- Departures map[string][]Departure
|
|
|
- TripsThroughStop map[string]map[string]StopOrder
|
|
|
- LineNames map[string]string
|
|
|
- TripsOffsets map[string]uint
|
|
|
- TripChangeOpts map[string]ChangeOption
|
|
|
- StopsCodeIndex CodeIndex
|
|
|
- StopsNameIndex map[string][]uint
|
|
|
- Stops map[string]string
|
|
|
- LineGraphs map[string]map[uint]LineGraph
|
|
|
- lineHeadsigns map[string]map[uint][]string
|
|
|
- LineIndex map[string][]uint
|
|
|
- LineIdIndex CodeIndex
|
|
|
- ValidFrom time.Time
|
|
|
- ValidFromError []error
|
|
|
- ValidTill time.Time
|
|
|
- ValidTillError []error
|
|
|
- tripHeadsigns map[string]string
|
|
|
- stopNames map[string]string
|
|
|
- feedInfo FeedInfo
|
|
|
- defaultLanguage string
|
|
|
- translations map[string]map[string]string
|
|
|
- schedules map[string]Schedule
|
|
|
- trips map[string]Trip
|
|
|
+ tripsInputIndex map[string]int64
|
|
|
+ routesInputIndex map[string]int64
|
|
|
+ stopsInputIndex map[string]int64
|
|
|
+ tripsOffsets map[string]uint
|
|
|
+
|
|
|
+ StopsCodeIndex CodeIndex
|
|
|
+ StopsNameIndex map[string][]uint
|
|
|
+ Stops map[string]string
|
|
|
+ LineGraphs map[string]map[uint]LineGraph
|
|
|
+ lineHeadsigns map[string]map[uint][]string
|
|
|
+ LineIndex map[string][]uint
|
|
|
+ LineIdIndex CodeIndex
|
|
|
+ ValidFrom time.Time
|
|
|
+ ValidFromError []error
|
|
|
+ ValidTill time.Time
|
|
|
+ ValidTillError []error
|
|
|
+ feedInfo FeedInfo
|
|
|
+ defaultLanguage string
|
|
|
+ translations map[string]map[string]string
|
|
|
+ schedules map[string]Schedule
|
|
|
+ trips map[string]Trip
|
|
|
}
|
|
|
|
|
|
// helper functions
|
|
@@ -616,257 +614,39 @@ func closeTrafficCalendarFile(c feedConverter, e error) (feedConverter, error) {
|
|
|
return c, e
|
|
|
}
|
|
|
|
|
|
-func clearDepartures(c feedConverter) feedConverter {
|
|
|
- c.Departures = map[string][]Departure{}
|
|
|
- return c
|
|
|
-}
|
|
|
-
|
|
|
-func convertDepartures(c feedConverter) (feedConverter, error) { // O(n:stop_times) ; ( -- departures:map[tripID][]departure, tripsThroughStop:map[stopID][]{tripID,order}, tripHeadsigns:map[tripID]stopID >> )
|
|
|
- path := c.TmpFeedPath
|
|
|
-
|
|
|
- file, err := os.Open(filepath.Join(path, "stop_times.txt"))
|
|
|
+func forEachRow(filename string, f func(int64, map[string]int, []string) error) error {
|
|
|
+ file, err := os.Open(filename)
|
|
|
if err != nil {
|
|
|
- return c, fmt.Errorf("while opening file: %w", err)
|
|
|
+ return fmt.Errorf("while opening file: %w", err)
|
|
|
}
|
|
|
defer file.Close()
|
|
|
|
|
|
- departures := map[string][]Departure{}
|
|
|
-
|
|
|
- r := csv.NewReader(bufio.NewReader(file))
|
|
|
- header, err := r.Read()
|
|
|
- if err != nil {
|
|
|
- return c, fmt.Errorf("while reading header: %w", err)
|
|
|
- }
|
|
|
- fields := map[string]int{}
|
|
|
- for i, headerField := range header {
|
|
|
- fields[headerField] = i
|
|
|
- }
|
|
|
-
|
|
|
- tripsThroughStop := map[string]map[string]StopOrder{}
|
|
|
- tripHeadsigns := map[string]string{}
|
|
|
-
|
|
|
- for {
|
|
|
- departure := Departure{}
|
|
|
- record, err := r.Read()
|
|
|
- if err == io.EOF {
|
|
|
- break
|
|
|
- }
|
|
|
- if err != nil {
|
|
|
- return c, fmt.Errorf("while reading a record: %w", err)
|
|
|
- }
|
|
|
-
|
|
|
- stopID := record[fields["stop_id"]]
|
|
|
-
|
|
|
- tripID := record[fields["trip_id"]]
|
|
|
- fmt.Sscanf(record[fields["stop_sequence"]], "%d", &departure.StopSequence)
|
|
|
- fmt.Sscanf(record[fields["pickup_type"]], "%d", &departure.Pickup)
|
|
|
- fmt.Sscanf(record[fields["drop_off_type"]], "%d", &departure.Dropoff)
|
|
|
-
|
|
|
- if _, ok := tripsThroughStop[stopID]; !ok {
|
|
|
- tripsThroughStop[stopID] = map[string]StopOrder{}
|
|
|
- }
|
|
|
- tripsThroughStop[stopID][tripID] = StopOrder{
|
|
|
- Sequence: departure.StopSequence,
|
|
|
- }
|
|
|
-
|
|
|
- if c.Feed.Flags().Headsign == HeadsignTripLastStop {
|
|
|
- tripHeadsigns[tripID] = stopID
|
|
|
- }
|
|
|
-
|
|
|
- var hours, minutes uint
|
|
|
- fmt.Sscanf(record[fields["arrival_time"]], "%d:%d", &hours, &minutes)
|
|
|
- departure.Time = hours*60 + minutes
|
|
|
-
|
|
|
- departures[tripID] = append(departures[tripID], departure)
|
|
|
- }
|
|
|
-
|
|
|
- c.tripHeadsigns = tripHeadsigns
|
|
|
- c.Departures = departures
|
|
|
- c.TripsThroughStop = tripsThroughStop
|
|
|
- return c, nil
|
|
|
-}
|
|
|
-
|
|
|
-func clearLineNames(c feedConverter) feedConverter {
|
|
|
- c.LineNames = map[string]string{}
|
|
|
- return c
|
|
|
-}
|
|
|
-
|
|
|
-func getLineNames(c feedConverter) (feedConverter, error) { // O(n:routes) ; ( -- lineNames:map[routeID]lineName >> )
|
|
|
- path := c.TmpFeedPath
|
|
|
-
|
|
|
- file, err := os.Open(filepath.Join(path, "routes.txt"))
|
|
|
- if err != nil {
|
|
|
- return c, fmt.Errorf("while opening file: %w", err)
|
|
|
- }
|
|
|
- defer file.Close()
|
|
|
- r := csv.NewReader(bufio.NewReader(file))
|
|
|
+ r := csv.NewReader(file)
|
|
|
header, err := r.Read()
|
|
|
if err != nil {
|
|
|
- return c, fmt.Errorf("while reading header: %w", err)
|
|
|
- }
|
|
|
- fields := map[string]int{}
|
|
|
- for i, headerField := range header {
|
|
|
- fields[headerField] = i
|
|
|
- }
|
|
|
-
|
|
|
- names := map[string]string{}
|
|
|
-
|
|
|
- for {
|
|
|
- record, err := r.Read()
|
|
|
- if err == io.EOF {
|
|
|
- break
|
|
|
- }
|
|
|
- if err != nil {
|
|
|
- return c, fmt.Errorf("while reading a record: %w", err)
|
|
|
- }
|
|
|
-
|
|
|
- routeID := record[fields["route_id"]]
|
|
|
- lineName := c.Feed.Flags().LineName
|
|
|
- for _, template := range []string{"route_short_name", "route_long_name"} {
|
|
|
- lineName = strings.Replace(lineName, "{{"+template+"}}", record[fields[template]], -1)
|
|
|
- }
|
|
|
- names[routeID] = lineName
|
|
|
- }
|
|
|
-
|
|
|
- c.LineNames = names
|
|
|
- return c, nil
|
|
|
-}
|
|
|
-
|
|
|
-func clearStopNames(c feedConverter) feedConverter {
|
|
|
- c.stopNames = map[string]string{}
|
|
|
- return c
|
|
|
-}
|
|
|
-
|
|
|
-func getStopNames(c feedConverter) (feedConverter, error) { // O(n:stops) ; ( -- stopNames[stopID]stopName >> )
|
|
|
- if c.Feed.Flags().Headsign != HeadsignTripLastStop {
|
|
|
- return c, nil
|
|
|
- }
|
|
|
-
|
|
|
- stopNames := map[string]string{}
|
|
|
-
|
|
|
- path := c.TmpFeedPath
|
|
|
-
|
|
|
- file, err := os.Open(filepath.Join(path, "stops.txt"))
|
|
|
- if err != nil {
|
|
|
- return c, fmt.Errorf("while opening file: %w", err)
|
|
|
- }
|
|
|
- defer file.Close()
|
|
|
-
|
|
|
- r := csv.NewReader(bufio.NewReader(file))
|
|
|
- header, err := r.Read()
|
|
|
- if err != nil {
|
|
|
- return c, fmt.Errorf("while reading header: %w", err)
|
|
|
- }
|
|
|
- fields := map[string]int{}
|
|
|
- for i, headerField := range header {
|
|
|
- fields[headerField] = i
|
|
|
- }
|
|
|
-
|
|
|
- for {
|
|
|
- record, err := r.Read()
|
|
|
- if err == io.EOF {
|
|
|
- break
|
|
|
- }
|
|
|
- if err != nil {
|
|
|
- return c, fmt.Errorf("while reading a record: %w", err)
|
|
|
- }
|
|
|
-
|
|
|
- stopID := record[fields["stop_id"]]
|
|
|
- stopName := record[fields["stop_name"]]
|
|
|
- stopNames[stopID] = stopName
|
|
|
- }
|
|
|
-
|
|
|
- c.stopNames = stopNames
|
|
|
-
|
|
|
- return c, nil
|
|
|
-}
|
|
|
-
|
|
|
-func clearTripsChangeOptions(c feedConverter) feedConverter {
|
|
|
- c.TripChangeOpts = map[string]ChangeOption{}
|
|
|
- return c
|
|
|
-}
|
|
|
-
|
|
|
-func clearTripsThroughStops(c feedConverter) feedConverter {
|
|
|
- c.TripsThroughStop = map[string]map[string]StopOrder{}
|
|
|
- return c
|
|
|
-}
|
|
|
-
|
|
|
-func convertTrips(c feedConverter) (feedConverter, error) { // O(n:trips) ; (departures, lineNames, stopNames -- tripsOffsets:map[tripID]offset, tripsChangeOpts:map[tripID]{lineID,headsign} >> trips)
|
|
|
- path := c.TmpFeedPath
|
|
|
- departures := c.Departures
|
|
|
- lineNames := c.LineNames
|
|
|
-
|
|
|
- file, err := os.Open(filepath.Join(path, "trips.txt"))
|
|
|
- if err != nil {
|
|
|
- return c, fmt.Errorf("while opening file: %w", err)
|
|
|
- }
|
|
|
- defer file.Close()
|
|
|
-
|
|
|
- result, err := os.Create(filepath.Join(path, "trips.bare"))
|
|
|
- if err != nil {
|
|
|
- return c, fmt.Errorf("while creating file: %w", err)
|
|
|
+ return fmt.Errorf("while reading header: %w", err)
|
|
|
}
|
|
|
- defer result.Close()
|
|
|
|
|
|
- r := csv.NewReader(bufio.NewReader(file))
|
|
|
- header, err := r.Read()
|
|
|
- if err != nil {
|
|
|
- return c, fmt.Errorf("while reading header: %w", err)
|
|
|
- }
|
|
|
fields := map[string]int{}
|
|
|
for i, headerField := range header {
|
|
|
fields[headerField] = i
|
|
|
}
|
|
|
|
|
|
- var offset uint = 0
|
|
|
- tripsOffsets := map[string]uint{}
|
|
|
-
|
|
|
- tripChangeOpts := map[string]ChangeOption{}
|
|
|
-
|
|
|
for {
|
|
|
- trip := Trip{}
|
|
|
+ offset := r.InputOffset()
|
|
|
record, err := r.Read()
|
|
|
if err == io.EOF {
|
|
|
break
|
|
|
}
|
|
|
if err != nil {
|
|
|
- return c, fmt.Errorf("while reading a record: %w", err)
|
|
|
- }
|
|
|
-
|
|
|
- trip.Id = record[fields["trip_id"]]
|
|
|
- switch c.Feed.Flags().Headsign {
|
|
|
- case HeadsignTripHeadsing:
|
|
|
- trip.Headsign = record[fields["trip_headsign"]]
|
|
|
- case HeadsignTripLastStop:
|
|
|
- trip.Headsign = c.stopNames[c.tripHeadsigns[trip.Id]]
|
|
|
- }
|
|
|
-
|
|
|
- trip.Departures = departures[trip.Id]
|
|
|
- trip.ScheduleID = record[fields["service_id"]]
|
|
|
- trip.LineID = record[fields["route_id"]]
|
|
|
- fmt.Sscanf(record[fields["direction_id"]], "%d", &trip.Direction)
|
|
|
-
|
|
|
- tripChangeOpts[trip.Id] = ChangeOption{
|
|
|
- LineName: lineNames[record[fields["route_id"]]],
|
|
|
- Headsign: translateFieldDefault(trip.Headsign, c.feedInfo.Language, c.defaultLanguage, c.translations),
|
|
|
- TranslatedHeadsigns: translateField(trip.Headsign, c.feedInfo.Language, c.defaultLanguage, c.translations),
|
|
|
- }
|
|
|
-
|
|
|
- bytes, err := bare.Marshal(&trip)
|
|
|
- if err != nil {
|
|
|
- return c, fmt.Errorf("while marshalling: %w", err)
|
|
|
+ return fmt.Errorf("while reading a record: %w", err)
|
|
|
}
|
|
|
- b, err := result.Write(bytes)
|
|
|
+ err = f(offset, fields, record)
|
|
|
if err != nil {
|
|
|
- return c, fmt.Errorf("while writing: %w", err)
|
|
|
+ return fmt.Errorf("while performing function: %w", err)
|
|
|
}
|
|
|
- tripsOffsets[trip.Id] = offset
|
|
|
- offset += uint(b)
|
|
|
}
|
|
|
-
|
|
|
- c.TripsOffsets = tripsOffsets
|
|
|
- c.TripChangeOpts = tripChangeOpts
|
|
|
- return c, nil
|
|
|
+ return nil
|
|
|
}
|
|
|
|
|
|
func clearStops(c feedConverter) feedConverter {
|
|
@@ -874,172 +654,8 @@ func clearStops(c feedConverter) feedConverter {
|
|
|
return c
|
|
|
}
|
|
|
|
|
|
-func convertStops(c feedConverter) (feedConverter, error) { // O(n:stops) ; (translations, tripsThroughStop, tripChangeOpts, tripOffsets -- stopsOffsetsByCode:CodeIndex, stopsOffsetsByName:map[name][]offsets >> stops)
|
|
|
- path := c.TmpFeedPath
|
|
|
- tripsThroughStop := c.TripsThroughStop
|
|
|
- tripChangeOpts := c.TripChangeOpts
|
|
|
- tripsOffsets := c.TripsOffsets
|
|
|
-
|
|
|
- file, err := os.Open(filepath.Join(path, "stops.txt"))
|
|
|
- if err != nil {
|
|
|
- return c, fmt.Errorf("while opening file: %w", err)
|
|
|
- }
|
|
|
- defer file.Close()
|
|
|
-
|
|
|
- result, err := os.Create(filepath.Join(path, "stops.bare"))
|
|
|
- if err != nil {
|
|
|
- return c, fmt.Errorf("while creating file: %w", err)
|
|
|
- }
|
|
|
- defer result.Close()
|
|
|
-
|
|
|
- r := csv.NewReader(bufio.NewReader(file))
|
|
|
- header, err := r.Read()
|
|
|
- if err != nil {
|
|
|
- return c, fmt.Errorf("while reading header: %w", err)
|
|
|
- }
|
|
|
- fields := map[string]int{}
|
|
|
- for i, headerField := range header {
|
|
|
- fields[headerField] = i
|
|
|
- }
|
|
|
-
|
|
|
- var offset uint = 0
|
|
|
- stopsOffsetsByName := map[string][]uint{}
|
|
|
- stopsOffsetsByCode := CodeIndex{}
|
|
|
- stops := map[string]string{}
|
|
|
-
|
|
|
- maxStopTripsLength := 0
|
|
|
-
|
|
|
- for {
|
|
|
- stop := Stop{}
|
|
|
- record, err := r.Read()
|
|
|
- if err == io.EOF {
|
|
|
- break
|
|
|
- }
|
|
|
- if err != nil {
|
|
|
- return c, fmt.Errorf("while reading a record: %w", err)
|
|
|
- }
|
|
|
-
|
|
|
- if f, ok := fields["location_type"]; ok && record[f] != "" && record[f] != "0" {
|
|
|
- // NOTE for now ignore everything that’s not a stop/platform
|
|
|
- // TODO use Portals (location_type == 2) to show on map if platform has a parent (location_type == 1) that has a Portal
|
|
|
- // TODO use location_type in {3,4} for routing inside stations (with pathways, transfers, and levels)
|
|
|
- continue
|
|
|
- }
|
|
|
-
|
|
|
- stopID := record[fields["stop_id"]]
|
|
|
-
|
|
|
- stopTrips := tripsThroughStop[stopID]
|
|
|
- stopTripsLength := len(stopTrips)
|
|
|
- if maxStopTripsLength < stopTripsLength {
|
|
|
- maxStopTripsLength = stopTripsLength
|
|
|
- }
|
|
|
-
|
|
|
- stop.Id = stopID
|
|
|
-
|
|
|
- templates := []string{"stop_code", "stop_id", "stop_name", "platform_code"}
|
|
|
- stop.Code = c.Feed.Flags().StopIdFormat
|
|
|
- for _, template := range templates {
|
|
|
- stop.Code = strings.Replace(stop.Code, "{{"+template+"}}", record[fields[template]], -1)
|
|
|
- }
|
|
|
- stop.Name = c.Feed.Flags().StopName
|
|
|
- for _, template := range templates {
|
|
|
- // TODO if '{{template}}' is empty
|
|
|
- stop.Name = strings.Replace(stop.Name, "{{"+template+"}}", record[fields[template]], -1)
|
|
|
- }
|
|
|
- if field, ok := fields["zone_id"]; ok {
|
|
|
- stop.Zone = record[field]
|
|
|
- }
|
|
|
- stop.NodeName = record[fields["stop_name"]]
|
|
|
-
|
|
|
- stops[record[fields["stop_id"]]] = stop.Code
|
|
|
-
|
|
|
- if field, ok := fields["stop_timezone"]; ok {
|
|
|
- stop.Timezone = record[field]
|
|
|
- }
|
|
|
-
|
|
|
- if c.feedInfo.Language == "mul" {
|
|
|
- key := record[fields["stop_name"]]
|
|
|
- if _, ok := c.translations[stop.NodeName][c.defaultLanguage]; !ok {
|
|
|
- stop.TranslatedNames = []Translation{{Language: c.defaultLanguage, Value: stop.Name}}
|
|
|
- stop.TranslatedNodeNames = []Translation{{Language: c.defaultLanguage, Value: stop.NodeName}}
|
|
|
- } else {
|
|
|
- stop.TranslatedNames = []Translation{{Language: c.defaultLanguage, Value: strings.ReplaceAll(stop.Name, key, c.translations[key][c.defaultLanguage])}}
|
|
|
- stop.TranslatedNodeNames = []Translation{{Language: c.defaultLanguage, Value: c.translations[key][c.defaultLanguage]}}
|
|
|
- }
|
|
|
- for language, value := range c.translations[key] {
|
|
|
- if language == c.defaultLanguage {
|
|
|
- continue
|
|
|
- }
|
|
|
- stop.TranslatedNames = append(stop.TranslatedNames, Translation{Language: c.defaultLanguage, Value: strings.ReplaceAll(stop.Name, key, value)})
|
|
|
- stop.TranslatedNodeNames = append(stop.TranslatedNodeNames, Translation{Language: c.defaultLanguage, Value: c.translations[key][value]})
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- var lat, lon float64
|
|
|
- fmt.Sscanf(record[fields["stop_lat"]], "%f", &lat)
|
|
|
- fmt.Sscanf(record[fields["stop_lon"]], "%f", &lon)
|
|
|
- stop.Position = Position{lat, lon}
|
|
|
-
|
|
|
- changeOptionMap := map[string]ChangeOption{}
|
|
|
- stop.ChangeOptions = []ChangeOption{}
|
|
|
- stop.Order = map[string]StopOrder{}
|
|
|
- for tripID, stopTrip := range stopTrips {
|
|
|
- changeOption := tripChangeOpts[tripID]
|
|
|
- stopOrder := StopOrder{
|
|
|
- TripOffset: tripsOffsets[tripID],
|
|
|
- Sequence: stopTrip.Sequence,
|
|
|
- }
|
|
|
- stop.Order[tripID] = stopOrder
|
|
|
- changeOptionMap[changeOption.LineName+"->"+changeOption.Headsign] = changeOption
|
|
|
- }
|
|
|
- for _, option := range changeOptionMap {
|
|
|
- stop.ChangeOptions = append(stop.ChangeOptions, option)
|
|
|
- }
|
|
|
- sort.Slice(stop.ChangeOptions, func(i, j int) bool {
|
|
|
- var num1, num2 int
|
|
|
- _, err1 := fmt.Sscanf(stop.ChangeOptions[i].LineName, "%d", &num1)
|
|
|
- _, err2 := fmt.Sscanf(stop.ChangeOptions[j].LineName, "%d", &num2)
|
|
|
- if err1 != nil && err2 != nil {
|
|
|
- return stop.ChangeOptions[i].LineName < stop.ChangeOptions[j].LineName
|
|
|
- } else if err1 != nil {
|
|
|
- return false
|
|
|
- } else if err2 != nil {
|
|
|
- return true
|
|
|
- } else {
|
|
|
- return num1 < num2
|
|
|
- }
|
|
|
- })
|
|
|
-
|
|
|
- bytes, err := bare.Marshal(&stop)
|
|
|
- if err != nil {
|
|
|
- return c, fmt.Errorf("while marshalling: %w", err)
|
|
|
- }
|
|
|
- b, err := result.Write(bytes)
|
|
|
- if err != nil {
|
|
|
- return c, fmt.Errorf("while writing: %w", err)
|
|
|
- }
|
|
|
- if len(stop.TranslatedNames) == 0 {
|
|
|
- stopsOffsetsByName[stop.Name] = append(stopsOffsetsByName[stop.Name], offset)
|
|
|
- }
|
|
|
- for _, v := range stop.TranslatedNames {
|
|
|
- stopsOffsetsByName[v.Value] = append(stopsOffsetsByName[v.Value], offset)
|
|
|
- }
|
|
|
- stopsOffsetsByCode[stop.Code] = offset
|
|
|
- offset += uint(b)
|
|
|
- }
|
|
|
-
|
|
|
- if maxStopTripsLength > 8192 {
|
|
|
- log.Printf("maximum length of StopOrder is %d, more than 8192, which may need to be tweaked", maxStopTripsLength)
|
|
|
- }
|
|
|
-
|
|
|
- c.StopsCodeIndex = stopsOffsetsByCode
|
|
|
- c.StopsNameIndex = stopsOffsetsByName
|
|
|
- c.Stops = stops
|
|
|
- return c, nil
|
|
|
-}
|
|
|
-
|
|
|
func clearTripOffsets(c feedConverter) feedConverter {
|
|
|
- c.TripsOffsets = map[string]uint{}
|
|
|
+ c.tripsOffsets = map[string]uint{}
|
|
|
return c
|
|
|
}
|
|
|
|
|
@@ -1635,11 +1251,11 @@ func writeLineIdIndex(c feedConverter) error {
|
|
|
|
|
|
func writeTripIndex(c feedConverter) error {
|
|
|
tripIndex := map[string][]uint{}
|
|
|
- for trip, offset := range c.TripsOffsets {
|
|
|
+ for trip, offset := range c.tripsOffsets {
|
|
|
tripIndex[trip] = []uint{offset}
|
|
|
}
|
|
|
err := writeNameIndex(c, tripIndex, "ix_trips.bare", true)
|
|
|
- c.TripsOffsets = map[string]uint{}
|
|
|
+ c.tripsOffsets = map[string]uint{}
|
|
|
return err
|
|
|
}
|
|
|
|
|
@@ -1670,7 +1286,6 @@ func writeCodeIndex(c feedConverter, i CodeIndex, filename string) error {
|
|
|
}
|
|
|
|
|
|
func deleteTxtFiles(c feedConverter) error {
|
|
|
- return nil
|
|
|
return file.DeleteTxtFiles(c.TmpFeedPath, c.GtfsFilename)
|
|
|
}
|
|
|
|
|
@@ -1723,21 +1338,27 @@ func convert(input ...interface{}) (interface{}, error) {
|
|
|
Tee(saveSchedules).
|
|
|
Tee(saveFeedInfo).
|
|
|
Recover(closeTrafficCalendarFile).
|
|
|
+ // ---
|
|
|
+ Bind(readInputTripsIndex).
|
|
|
+ Bind(readInputStopsIndex).
|
|
|
+ Bind(readInputRoutesIndex).
|
|
|
Bind(convertDepartures).
|
|
|
- Bind(getLineNames).
|
|
|
- Bind(getStopNames).
|
|
|
- Bind(convertTrips).
|
|
|
- Map(clearDepartures).
|
|
|
- Map(clearStopNames).
|
|
|
- Map(clearLineNames).
|
|
|
+ Map(dropInputRoutesIndex).
|
|
|
+ Map(dropInputStopsIndex).
|
|
|
+ Map(dropInputTripsIndex).
|
|
|
+ // ---
|
|
|
+ Tee(sortChangeOptions).
|
|
|
+ Tee(sortTripsThroughStop).
|
|
|
+ Bind(readChangeOptionsIndex).
|
|
|
+ Bind(readTripsThroughStopsIndex).
|
|
|
Bind(convertStops).
|
|
|
+ Map(dropInputRoutesIndex).
|
|
|
+ Map(dropInputStopsIndex).
|
|
|
Tee(writeTripIndex).
|
|
|
Map(clearTripOffsets).
|
|
|
Tee(writeStopNameIndex).
|
|
|
Tee(writeStopCodeIndex).
|
|
|
- Map(clearTripsChangeOptions).
|
|
|
- Map(clearTripsThroughStops).
|
|
|
- Map(clearLineNames).
|
|
|
+ // ---
|
|
|
Bind(getTrips).
|
|
|
Bind(convertLineGraphs).
|
|
|
Map(clearStops).
|