Documentation ¶
Overview ¶
Package nhlgc is a library that interacts with the NHL GameCenter API.
Index ¶
- Constants
- type ByHighestBandwidth
- type DecryptionParameters
- type GameDetails
- type GameHighlight
- type GameHighlights
- type GameInfo
- type GamePublishPoint
- type GameTimeGMT
- type GamesList
- type LogicError
- type NHLGameCenter
- func (gc *NHLGameCenter) GetGameDetails(season, gameID string) (game GameDetails, err error)
- func (gc *NHLGameCenter) GetGameHighlights(season, gameID string) (highlights GameHighlights, err error)
- func (gc *NHLGameCenter) GetGamePlaylists(season, gameID, streamType, streamSource string) (playlists []StreamPlaylist, err error)
- func (gc *NHLGameCenter) GetMediaPlaylist(master StreamPlaylist) (media StreamPlaylist, err error)
- func (gc *NHLGameCenter) GetPlaylistsFromURL(reqUrl string) (playlists []StreamPlaylist, err error)
- func (gc *NHLGameCenter) GetRecentGames() (GamesList, error)
- func (gc *NHLGameCenter) GetStreamDecryptionParameters(media StreamPlaylist) (params []DecryptionParameters, err error)
- func (gc *NHLGameCenter) GetTodaysGames() (GamesList, error)
- func (gc *NHLGameCenter) Login(username, password string, rogers bool) error
- type NetworkError
- type OptionalUint64
- type StreamPlaylist
Constants ¶
const ( StreamTypeArchive = "archive" StreamTypeCondensed = "condensed" StreamTypeDVR = "dvr" StreamTypeLive = "live" )
Valid stream types for the publishPoint API endpoint.
const ( StreamSourceHome = "2" StreamSourceAway = "4" StreamSourceFrench = "8" )
Stream sources.
const ( SeasonTypePre = "01" SeasonTypeReg = "02" SeasonTypePost = "03" )
Season type identifiers.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ByHighestBandwidth ¶
type ByHighestBandwidth []StreamPlaylist
func (ByHighestBandwidth) Len ¶
func (a ByHighestBandwidth) Len() int
func (ByHighestBandwidth) Less ¶
func (a ByHighestBandwidth) Less(i, j int) bool
func (ByHighestBandwidth) Swap ¶
func (a ByHighestBandwidth) Swap(i, j int)
type DecryptionParameters ¶
type GameDetails ¶
type GameDetails struct { GID string `xml:"gid"` Season string `xml:"season"` Type string `xml:"type"` ID string `xml:"id"` Date GameTimeGMT `xml:"date"` GameStartTime GameTimeGMT `xml:"gameTimeGMT"` GameEndTime GameTimeGMT `xml:"gameEndTimeGMT"` HomeTeam string `xml:"homeTeam"` AwayTeam string `xml:"awayTeam"` HomeGoals OptionalUint64 `xml:"homeGoals"` AwayGoals OptionalUint64 `xml:"awayGoals"` Blocked bool `xml:"blocked"` GameState string `xml:"gameState"` Result string `xml:"result"` IsLive bool `xml:"isLive"` PublishPoint string `xml:"program>publishPoint"` }
type GameHighlight ¶
type GameHighlights ¶
type GameHighlights map[string]GameHighlight
type GameInfo ¶
type GameInfo struct {
Game GameDetails `xml:"game"`
}
type GamePublishPoint ¶
type GamePublishPoint struct {
Path string `xml:"path"`
}
type GameTimeGMT ¶
func (*GameTimeGMT) String ¶
func (gt *GameTimeGMT) String() string
func (*GameTimeGMT) UnmarshalXML ¶
func (gt *GameTimeGMT) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
type GamesList ¶
type GamesList struct {
Games []GameDetails `xml:"games>game"`
}
type LogicError ¶
type LogicError struct {
// contains filtered or unexported fields
}
func (LogicError) Error ¶
func (e LogicError) Error() string
type NHLGameCenter ¶
type NHLGameCenter struct {
// contains filtered or unexported fields
}
func (*NHLGameCenter) GetGameDetails ¶
func (gc *NHLGameCenter) GetGameDetails(season, gameID string) (game GameDetails, err error)
GetGameDetails retrieves details about the specified game.
func (*NHLGameCenter) GetGameHighlights ¶
func (gc *NHLGameCenter) GetGameHighlights(season, gameID string) (highlights GameHighlights, err error)
GetGameHighlights retrieves URLs for highlight videos for the specified game. The return value is a map, where the key is a label for the source of the highlight. For example:
highlights := GameHighlights{ "home": GameHighlight{ PublishPoint: "http://example.com/home-highlights", }, "away": GameHighlight{ PublishPoint: "http://example.com/away-highlights", }, "french": GameHighlight{ PublishPoint: "http://example.com/highlights-in-french", }, }
func (*NHLGameCenter) GetGamePlaylists ¶
func (gc *NHLGameCenter) GetGamePlaylists(season, gameID, streamType, streamSource string) (playlists []StreamPlaylist, err error)
GetGamePlaylists retrieves and parses the master playlist for the specified game. This playlist will generally contain multiple media playlists of varying stream quality.
func (*NHLGameCenter) GetMediaPlaylist ¶
func (gc *NHLGameCenter) GetMediaPlaylist(master StreamPlaylist) (media StreamPlaylist, err error)
GetMediaPlaylist retrieves and parses the media playlist referenced by the specified master playlist.
func (*NHLGameCenter) GetPlaylistsFromURL ¶
func (gc *NHLGameCenter) GetPlaylistsFromURL(reqUrl string) (playlists []StreamPlaylist, err error)
GetPlaylistsFromURL retrieves and parses a M3U8 object from the specified URL. The return value is a list of master or media playlists.
func (*NHLGameCenter) GetRecentGames ¶
func (gc *NHLGameCenter) GetRecentGames() (GamesList, error)
GetRecentGames retrieves a list of recent and upcoming games.
func (*NHLGameCenter) GetStreamDecryptionParameters ¶
func (gc *NHLGameCenter) GetStreamDecryptionParameters(media StreamPlaylist) (params []DecryptionParameters, err error)
GetStreamDecryptionParameters reads the specified media playlist and returns the parameters required to decrypt each video segment.
func (*NHLGameCenter) GetTodaysGames ¶
func (gc *NHLGameCenter) GetTodaysGames() (GamesList, error)
GetTodaysGames retrieves a list of games that take place today.
type NetworkError ¶
type NetworkError struct { LogicError StatusCode int Location string }
func (NetworkError) Error ¶
func (e NetworkError) Error() string
type OptionalUint64 ¶
type OptionalUint64 uint64
func (*OptionalUint64) UnmarshalXML ¶
func (o *OptionalUint64) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error