123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- // SPDX-FileCopyrightText: Adam Evyčędo
- //
- // SPDX-License-Identifier: AGPL-3.0-or-later
- package traffic
- import (
- "apiote.xyz/p/szczanieckiej/config"
- "apiote.xyz/p/szczanieckiej/transformers"
- "time"
- "golang.org/x/text/language"
- "golang.org/x/text/transform"
- )
- type KrakowZtp struct{}
- func (KrakowZtp) getTimezone() *time.Location {
- l, _ := time.LoadLocation("Europe/Warsaw")
- return l
- }
- func (KrakowZtp) ConvertVehicles() ([]Vehicle, error) {
- return []Vehicle{}, nil
- }
- func (f KrakowZtp) GetVersions(date time.Time, timezone *time.Location) ([]Version, error) {
- startDate := time.Date(date.Year(), date.Month(), date.Day(), 0, 0, 0, 0, timezone)
- endDate := time.Date(date.Year(), date.Month(), date.Day(), 23, 59, 59, 0, timezone)
- v := Version{
- Link: "https://gtfs.ztp.krakow.pl/GTFS_KRK_A.zip",
- ValidFrom: startDate,
- ValidTill: endDate,
- }
- // https://gtfs.ztp.krakow.pl/GTFS_KRK_T.zip
- return []Version{v}, nil
- }
- func (KrakowZtp) RealtimeFeeds() map[RealtimeFeedType]string {
- return map[RealtimeFeedType]string{
- ALERTS: "https://gtfs.ztp.krakow.pl/ServiceAlerts_A.pb",
- TRIP_UPDATES: "https://gtfs.ztp.krakow.pl/TripUpdates_A.pb",
- //"https://gtfs.ztp.krakow.pl/TripUpdates_T.pb",
- VEHICLE_POSITIONS: "https://gtfs.ztp.krakow.pl/VehiclePositions_A.pb",
- //"https://gtfs.ztp.krakow.pl/VehiclePositions_T.pb",
- }
- }
- func (KrakowZtp) LuaUpdatesScript(c config.Config) string {
- return ""
- }
- func (KrakowZtp) String() string {
- return "krakow_ztp"
- }
- func (z KrakowZtp) Transformer() transform.Transformer {
- return transformers.TransformerPL
- }
- func (z KrakowZtp) Name() string {
- return "ZTP Kraków"
- }
- func (z KrakowZtp) Attribution() map[language.Tag]string {
- return map[language.Tag]string{
- language.Und: "GTFS files downloaded from https://gtfs.ztp.krakow.pl/ and converted to TRAFFIC",
- language.English: "GTFS files downloaded from https://gtfs.ztp.krakow.pl/ and converted to TRAFFIC",
- language.Polish: "Pliki GTFS pobrane z https://gtfs.ztp.krakow.pl/ przekonwertowane do formatu TRAFFIC",
- }
- }
- func (z KrakowZtp) Description() map[language.Tag]string {
- return map[language.Tag]string{
- language.Und: "Buses timetable for Kraków public transport organised by Zarząd Transportu Publicznego (ZTP)",
- language.English: "Buses timetable for Kraków public transport organised by Zarząd Transportu Publicznego (ZTP)",
- language.BritishEnglish: "Buses timetable for Kraków public transport organised by Zarząd Transportu Publicznego (ZTP)",
- language.AmericanEnglish: "Buses timetable for Kraków public transport organized by Zarząd Transportu Publicznego (ZTP)",
- language.Polish: "Rozkład jazdy autobusów krakowskiego transportu publicznego organizowanego przez Zarząd Transportu Publicznego (ZTP)",
- }
- }
- func (z KrakowZtp) Flags() FeedFlags {
- return FeedFlags{
- Headsign: HeadsignTripHeadsing,
- StopIdFormat: "{{stop_id}}",
- StopName: "{{stop_name}}",
- LineName: "{{route_short_name}}",
- }
- }
- func (z KrakowZtp) FeedPrepareZip(path string) error {
- return nil
- }
- func (z KrakowZtp) QRInfo() (string, QRLocation, string) {
- return "", QRLocationNone, ""
- }
|