schedule

package
v0.0.0-...-cdff340 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 30, 2019 License: MIT Imports: 11 Imported by: 0

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

View Source
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"
)
View Source
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

View Source
var DoShowOperationMode bool

DoShowOperationMode determines whether info about the urban transit operation mode should be displayed for DetailedTimetable objects.

View Source
var DoShowRoute bool

DoShowRoute determines whether info about the urban transit line route should be displayed for DetailedTimetable objects.

View Source
var DoTranslateStopNames bool

DoTranslateStopNames determines whether stop names should be translated from Bulgarian to the local language.

View Source
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

func GetLine(vehicleType string, lineNumber string) (line *Line, err error)

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

func (l *Line) GetRouteMapByOperationMode(operationModeCode string) (routeMap map[string]*Route)

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.

func (*Line) String

func (l *Line) String() string

type Lines

type Lines struct {
	BusLineNumbers, TrolleybusLineNumbers, TramLineNumbers []string
}

Lines represents the numbers of all urban transit lines.

func GetLines

func GetLines() (lines *Lines, err error)

GetLines fetches and returns all urban transit lines.

func (*Lines) String

func (ls *Lines) String() (str string)

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

type Route struct {
	Code, Name string
	StopList
	StopMap
}

Route represents the sequence of stops where an urban transit line stops when traveling in a specific direction.

func (*Route) String

func (r *Route) String() string

type RouteList

type RouteList []*Route

RouteList represents a list of routes.

func (RouteList) String

func (nrl RouteList) String() string

type RouteMap

type RouteMap map[string]*Route

RouteMap represents a map from the code of each urban transit line route to its corresponding Route object.

type Stop

type Stop struct {
	Code, Name string
}

Stop represents an urban transit stop.

func (*Stop) String

func (s *Stop) String() string

type StopList

type StopList []*Stop

StopList represents a list of urban transit stops.

func (StopList) String

func (sl StopList) String() string

type StopMap

type StopMap map[string]*Stop

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.

func GetTimetable

func GetTimetable(operationModeCode string, routeCode string, stopCode string) (timetable Timetable, err error)

GetTimetable fetches and returns the urban transit stop timetable matching the specified operationModeCode, routeCode and stopCode.

func (Timetable) String

func (t Timetable) String() string

Directories

Path Synopsis
Package l10n provides localization for the `schedule` package.
Package l10n provides localization for the `schedule` package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL