timetable.go 432 B

123456789101112131415161718192021
  1. // SPDX-FileCopyrightText: Adam Evyčędo
  2. //
  3. // SPDX-License-Identifier: AGPL-3.0-or-later
  4. package traffic
  5. import (
  6. "apiote.xyz/p/szczanieckiej/config"
  7. "io"
  8. "os"
  9. "path/filepath"
  10. )
  11. func GetTimetable(feedID string, t *Traffic, c config.Config) (io.ReadCloser, error) {
  12. validity, _, err := ParseDate("", feedID, t)
  13. path := filepath.Join(c.FeedsPath, feedID, string(validity)+".txz")
  14. f, err := os.Open(path)
  15. return f, err
  16. }