Documentation
¶
Overview ¶
Package tmdb implements a client for the TMDB API https://developer.themoviedb.org/docs/getting-started
Index ¶
- Constants
- func OptQuota(quota uint) client.ClientOpt
- type Client
- func (c *Client) GetMovie(ctx context.Context, id uint64) (*schema.MovieDetails, error)
- func (c *Client) GetTVEpisode(ctx context.Context, id, season, episode uint64) (*schema.TVEpisode, error)
- func (c *Client) GetTVShow(ctx context.Context, id uint64) (*schema.TVShowDetails, error)
- func (c *Client) Image(ctx context.Context, size, path string) ([]byte, error)
- func (c *Client) SearchMovies(ctx context.Context, req schema.MovieSearchRequest) (*schema.MovieSearchResponse, error)
- func (c *Client) SearchTVShows(ctx context.Context, req schema.TVSearchRequest) (*schema.TVSearchResponse, error)
- type Query
Constants ¶
const ( SizePoster = "w780" SizeBackdrop = "w780" SizeStill = "w300" SizeOriginal = "original" )
The sizes of images, which are the widths TMDB has, or the original
const ( // DefaultQuota is the most requests each minute, unless OptQuota sets // another, which is the rate limit DefaultQuota = uint(rateLimit * 60) )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
Client is a profile HTTP client that wraps the base HTTP client
func New ¶
New creates a TMDB client with the API Read Access Token, and options. Its requests are limited to DefaultQuota each minute, unless OptQuota sets another.
func (*Client) GetMovie ¶ added in v1.10.5
GetMovie returns the details of a movie, such as its runtime
func (*Client) GetTVEpisode ¶ added in v1.10.6
func (c *Client) GetTVEpisode(ctx context.Context, id, season, episode uint64) (*schema.TVEpisode, error)
GetTVEpisode returns an episode of a TV show, by its season and episode numbers, such as its name and runtime, with its identifiers in other databases, such as IMDb
func (*Client) GetTVShow ¶ added in v1.10.6
GetTVShow returns the details of a TV show, such as the typical runtimes of its episodes, with its identifiers in other databases, such as IMDb
func (*Client) Image ¶ added in v1.10.8
Image returns the image at the path, which is a movie's or show's poster or backdrop path, or an episode's still path, such as /qJ2tW6WMUDux911r6m7haRef0WH.jpg, in the size, such as SizePoster. The image server doesn't need the API token, so it isn't sent, but the request counts towards the client's quota.
func (*Client) SearchMovies ¶
func (c *Client) SearchMovies(ctx context.Context, req schema.MovieSearchRequest) (*schema.MovieSearchResponse, error)
func (*Client) SearchTVShows ¶ added in v1.10.6
func (c *Client) SearchTVShows(ctx context.Context, req schema.TVSearchRequest) (*schema.TVSearchResponse, error)
SearchTVShows returns a page of the TV shows whose names match the search, with the most relevant first. TMDB searches shows, rather than episodes, which are got from a show with GetTVEpisode.
type Query ¶
type Query struct {
Name string
Year int // 0 if no year was found
Season int // 0 unless Episode is also set
Episode int // 0 unless this looks like a TV episode
}
Query is a search query extracted from a media file's path: the title to search for, its release year if present, and (for a TV episode) its season/episode number.
func ExtractQuery ¶
ExtractQuery derives a search query - title, year, and (for a TV episode) season/episode - from a media file's path.