Documentation
¶
Overview ¶
Package tmdb implements metadata.Provider against The Movie Database's v3 REST API.
Index ¶
Constants ¶
const ( // DefaultBaseURL is TMDB's v3 API root. DefaultBaseURL = "https://api.themoviedb.org/3" // DefaultPosterBaseURL is TMDB's image CDN at the w500 size. TMDB // returns poster paths ("/abc.jpg"), never absolute URLs, so a size // prefix has to be chosen client-side; w500 is the size TMDB's own // documentation uses for list art. DefaultPosterBaseURL = "https://image.tmdb.org/t/p/w500" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a TMDB v3 API client.
func New ¶
New creates a TMDB client. It performs no network call: the only way it fails is an empty API key.
func (*Client) LookupShow ¶
func (c *Client) LookupShow(ctx context.Context, title string, year int) (*metadata.ShowMetadata, error)
LookupShow resolves a show against TMDB in two requests: GET /search/tv to find it, then GET /tv/{id} for the genres, certification and cross-references a search hit does not carry.
type Config ¶
type Config struct {
// APIKey is the TMDB v3 API key. The caller supplies it -- this
// package never reads the environment.
APIKey string
// BaseURL overrides DefaultBaseURL. Tests point it at an httptest
// server.
BaseURL string
// PosterBaseURL overrides DefaultPosterBaseURL, to pick a different
// image size or a mirror.
PosterBaseURL string
// Language is the tag TMDB answers in (an ISO 639-1 code, optionally
// with a region: "en-US", "fr-FR"). Defaults to defaultLanguage.
Language string
}
Config configures a TMDB client.