-- import "github.com/rickyninja/tvmaze"
Package tvmaze is an HTTP Client for the tvmaze API.
type Candidate struct {
Score float64
Show Show
}
Candidate represents a search candidate.
type Client struct {
Debug bool
BaseURI string
Region string
Cache *cache.Cache
CacheFile string
UseCache bool
*http.Client
// UserAgent may be set to identify your application.
UserAgent string
}
Client is a tvmaze client.
func NewClient(cachefile string) (*Client, error)
NewClient returns a ready to use Client.
func (c *Client) FindShow(showname string) (Show, error)
FindShow searches tvmaze for showname, and returns it as a Show if a match is found.
func (c *Client) GetEpisodes(showID int64) ([]Episode, error)
GetEpisodes queries tvmaze, and returns a list of Episodes.
func (c *Client) GetShow(show string) ([]Candidate, error)
GetShow queries tvmaze for show, and returns Candidates that may be a match.
func (c *Client) Go(uri *url.URL) ([]byte, error)
Go does an HTTP GET to tvmaze with the provided uri, and returns the response body. It will cache response if UseCache is true.
func (c *Client) WriteCache() error
WriteCache writes cache contents to disk.
type Country struct {
Name string
Code string
TimeZone string
}
Country represents the country the show aired in.
type Episode struct {
ID int64
URL string
Name string
Season int
Number int
AirDate string
AirTime string
AirStamp string
Runtime int
//Image
Summary string
Links Links `json:"_links"`
}
Episode represents a tv episode.
type External struct {
TVRage int64
TheTVDB int64
}
External represents a 3rd party tv api.
type Image struct {
Medium string
Original string
}
Image represents an image.
type Link struct {
Href string
}
Link represents a uri link.
type Links struct {
Self Link
PreviousEpisode Link
}
Links represents Episode links.
type Network struct {
ID int
Name string
Country Country
}
Network represents the tv network airing the show.
type Rating struct {
Average float64
}
Rating represents a tv show rating.
type Schedule struct {
Time string
Days []string
}
Schedule represents a Show schedule.
type Show struct {
ID int64
URL string
Name string
Type string
Language string
Genres []string
Status string
Runtime int
Premiered string
Schedule Schedule
Rating Rating
Weight int
Network Network
//WebChannel
Externals External
Image Image
Summary string
Updated int64
Links Links
}
Show represents a tv show.