Documentation ¶
Overview ¶
Package schedule implements facilities for fetching of information from the schedule pages on the Urban Mobility Centre website via HTML scraping.
Index ¶
- Constants
- Variables
- type Line
- func (line *Line) GetDetailedTimetableString(operationModeCode string, routeCode string, stopCode string) (detailedTimetableString string, err error)
- func (line *Line) GetDetailedTimetableStrings(operationModeCode string, routeCode string, stopCode string) (detailedTimetableStrings []string, err error)
- func (l *Line) GetOperationModeByName(name string, isExactMatch bool) *OperationMode
- func (l *Line) GetOperationModeMap() (operationModeMap map[string]*OperationMode)
- func (l *Line) GetRouteByNameAndOperationMode(name string, operationModeCode string, isExactMatch bool) *Route
- func (l *Line) GetRouteMapByOperationMode(operationModeCode string) (routeMap map[string]*Route)
- func (l *Line) GetStopByNameOperationModeAndRoute(name string, operationModeCode string, routeCode string, isExactMatch bool) *Stop
- func (l *Line) GetStopMapByOperationModeAndRoute(operationModeCode string, routeCode string) (stopMap map[string]*Stop)
- func (l *Line) String() string
- type Lines
- type OperationMode
- type OperationModeRoutes
- type OperationModeRoutesList
- type OperationModeRoutesMap
- type Route
- type RouteList
- type RouteMap
- type Stop
- type StopList
- type StopMap
- type Timetable
Constants ¶
const ( // Scheme represents the URL scheme for schedule-related pages. Scheme = "https" // Hostname represents the URL hostname for schedule-related pages. Hostname = "schedules.sofiatraffic.bg" )
const ( // VehicleTypeBus represents a bus. VehicleTypeBus = "autobus" // VehicleTypeTrolleybus represents a trolleybus. VehicleTypeTrolleybus = "trolleybus" // VehicleTypeTram represents a tram. VehicleTypeTram = "tramway" // VehicleTypeMetro represents the metro. VehicleTypeMetro = "metro" )
Variables ¶
var DoShowOperationMode bool
DoShowOperationMode determines whether info about the urban transit operation mode should be displayed for DetailedTimetable objects.
var DoShowRoute bool
DoShowRoute determines whether info about the urban transit line route should be displayed for DetailedTimetable objects.
var DoTranslateStopNames bool
DoTranslateStopNames determines whether stop names should be translated from Bulgarian to the local language.
var StopNameTranslator map[string]string
StopNameTranslator maps names of stops in Bulgarian to their translation in the local language.
Functions ¶
This section is empty.
Types ¶
type Line ¶
type Line struct {
VehicleType, LineNumber string
OperationModeRoutesList
OperationModeRoutesMap
}
Line represents an urban transit line.
func GetLine ¶
GetLine returns the urban transit line with the specified vehicleType and lineNumber.
func (*Line) GetDetailedTimetableString ¶
func (line *Line) GetDetailedTimetableString(operationModeCode string, routeCode string, stopCode string) (detailedTimetableString string, err error)
GetDetailedTimetableString fetches and returns a detailed string representation of the urban transit stop timetable matching the specified operationModeCode, routeCode and stopCode (annotated with information obtained from the Line object).
func (*Line) GetDetailedTimetableStrings ¶
func (line *Line) GetDetailedTimetableStrings(operationModeCode string, routeCode string, stopCode string) (detailedTimetableStrings []string, err error)
GetDetailedTimetableStrings fetches and returns a detailed string representation of the urban transit stop timetables for the specified line matching the specified operationModeCode, routeCode and stopCode.
func (*Line) GetOperationModeByName ¶
func (l *Line) GetOperationModeByName(name string, isExactMatch bool) *OperationMode
GetOperationModeByName returns the operation mode with the specified name for the specified urban transit line.
func (*Line) GetOperationModeMap ¶
func (l *Line) GetOperationModeMap() (operationModeMap map[string]*OperationMode)
GetOperationModeMap returns a map from operation mode names to operation modes for the specific urban transit line.
func (*Line) GetRouteByNameAndOperationMode ¶
func (l *Line) GetRouteByNameAndOperationMode(name string, operationModeCode string, isExactMatch bool) *Route
GetRouteByNameAndOperationMode returns the route with the specified name for the specified operation mode of the specific urban transit line.
func (*Line) GetRouteMapByOperationMode ¶
GetRouteMapByOperationMode returns a map from route names to routes for the specified operation mode of the specific urban transit line.
func (*Line) GetStopByNameOperationModeAndRoute ¶
func (l *Line) GetStopByNameOperationModeAndRoute(name string, operationModeCode string, routeCode string, isExactMatch bool) *Stop
GetStopByNameOperationModeAndRoute returns the stop with the specified name for the specified operation mode and route of the specific urban transit line.
func (*Line) GetStopMapByOperationModeAndRoute ¶
func (l *Line) GetStopMapByOperationModeAndRoute(operationModeCode string, routeCode string) (stopMap map[string]*Stop)
GetStopMapByOperationModeAndRoute returns a map from stop names to stops for the specified operation mode and route of the specific urban transit line.
type Lines ¶
type Lines struct {
BusLineNumbers, TrolleybusLineNumbers, TramLineNumbers []string
}
Lines represents the numbers of all urban transit lines.
type OperationMode ¶
type OperationMode struct {
Code, Name string
}
OperationMode represents a type of urban transit line schedule classified by the frequency of vehicle arrivals (which is determined by the current day being a workday or a holiday).
func (*OperationMode) String ¶
func (om *OperationMode) String() string
type OperationModeRoutes ¶
type OperationModeRoutes struct { *OperationMode RouteList RouteMap }
OperationModeRoutes represents the routes for a specific urban transit line operation mode.
func (*OperationModeRoutes) String ¶
func (omr *OperationModeRoutes) String() string
type OperationModeRoutesList ¶
type OperationModeRoutesList []*OperationModeRoutes
OperationModeRoutesList represents a list of OperationModeRoutes objects.
func (OperationModeRoutesList) String ¶
func (omrl OperationModeRoutesList) String() string
type OperationModeRoutesMap ¶
type OperationModeRoutesMap map[string]*OperationModeRoutes
OperationModeRoutesMap represents a map from the code of each urban transit line operation mode to its corresponding OperationModeRoutes object.
type Route ¶
Route represents the sequence of stops where an urban transit line stops when traveling in a specific direction.
type RouteMap ¶
RouteMap represents a map from the code of each urban transit line route to its corresponding Route object.
type StopMap ¶
StopMap represents a map from the code of each urban transit stop to its corresponding Stop object.
type Timetable ¶
type Timetable []string
Timetable represents a list of urban transit vehicle arrival times.