Documentation
¶
Overview ¶
Package tmdbtv provides a TMDB API v3 client for TV series data.
Index ¶
- type CastMember
- type Client
- func (c *Client) DiscoverTVByGenre(ctx context.Context, genreID, page int) (*PaginatedSeries, error)
- func (c *Client) GetAlternativeTitles(ctx context.Context, tmdbID int) ([]string, error)
- func (c *Client) GetExternalIDs(ctx context.Context, tmdbID int) (ExternalIDs, error)
- func (c *Client) GetOnTheAirTV(ctx context.Context, page int) (*PaginatedSeries, error)
- func (c *Client) GetPerson(ctx context.Context, personID int) (*Person, error)
- func (c *Client) GetPersonTVCredits(ctx context.Context, personID int, personType string) ([]PersonCredit, error)
- func (c *Client) GetPopularTV(ctx context.Context, page int) (*PaginatedSeries, error)
- func (c *Client) GetSeasonEpisodes(ctx context.Context, tmdbID int, seasonNum int) ([]EpisodeDetail, error)
- func (c *Client) GetSeries(ctx context.Context, tmdbID int) (*SeriesDetail, error)
- func (c *Client) GetSeriesExtended(ctx context.Context, tmdbID int) (*SeriesDetail, error)
- func (c *Client) GetTVGenres(ctx context.Context) ([]Genre, error)
- func (c *Client) GetTopRatedTV(ctx context.Context, page int) (*PaginatedSeries, error)
- func (c *Client) GetTrendingTV(ctx context.Context, window string, page int) (*PaginatedSeries, error)
- func (c *Client) SearchSeries(ctx context.Context, query string, year int) ([]SearchResult, error)
- type CrewMember
- type EpisodeDetail
- type ExternalIDs
- type Genre
- type PaginatedSeries
- type Person
- type PersonCredit
- type SearchResult
- type SeasonSummary
- type SeriesDetail
- type SeriesRecommendation
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CastMember ¶
CastMember is a top-billed cast entry from the credits append.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a TMDB API v3 HTTP client scoped to TV series endpoints. All outbound requests are logged. The API key is never logged. Outbound calls are rate-limited and GET responses are cached for a short TTL. Client is safe for concurrent use.
func New ¶
New creates a new tmdbtv Client. apiKey must not be empty. logger is used to log outbound requests; the API key value is replaced with "***" in logged URLs.
func (*Client) DiscoverTVByGenre ¶
func (c *Client) DiscoverTVByGenre(ctx context.Context, genreID, page int) (*PaginatedSeries, error)
DiscoverTVByGenre returns popular series in the given TMDB genre.
func (*Client) GetAlternativeTitles ¶
GetAlternativeTitles fetches the list of alternate titles TMDB knows about for the series. Includes per-region marketing names ("Star Wars: Andor" for "Andor"), original-language titles, and any user-submitted aliases. The canonical title is NOT included — callers prepend it themselves so the matcher checks against the full set.
Returns an empty slice (no error) when TMDB has no alternates.
func (*Client) GetExternalIDs ¶
GetExternalIDs returns the series' IMDb and TVDB ids (/tv/{id}/external_ids). Either may be empty/zero when TMDB has none.
func (*Client) GetOnTheAirTV ¶
GetOnTheAirTV returns series with episodes airing in the next ~7 days. This is the TV analog to a movies "upcoming" list (TMDB has no /tv/upcoming).
func (*Client) GetPersonTVCredits ¶
func (c *Client) GetPersonTVCredits(ctx context.Context, personID int, personType string) ([]PersonCredit, error)
GetPersonTVCredits returns the TV series a person is credited on. For personType "director" it returns crew credits with job "Director"; for anything else (actors) it returns top-billed cast credits (order < 5), mirroring Prism's movie filmography behaviour.
func (*Client) GetPopularTV ¶
func (*Client) GetSeasonEpisodes ¶
func (c *Client) GetSeasonEpisodes(ctx context.Context, tmdbID int, seasonNum int) ([]EpisodeDetail, error)
GetSeasonEpisodes fetches the episode list for a single season.
func (*Client) GetSeries ¶
GetSeries fetches full series details by TMDB ID, including the season list.
func (*Client) GetSeriesExtended ¶
GetSeriesExtended fetches the same /tv/{id} payload as GetSeries but also requests credits and recommendations via append_to_response, and populates the Rating, Cast, Crew, and Recommendations fields. It is used by the Discover detail page; Add/RefreshMetadata use the lighter GetSeries instead.
func (*Client) GetTVGenres ¶
GetTVGenres returns the list of TMDB TV genres.
func (*Client) GetTopRatedTV ¶
GetTopRatedTV returns the highest-rated TV series from TMDB.
func (*Client) GetTrendingTV ¶
func (c *Client) GetTrendingTV(ctx context.Context, window string, page int) (*PaginatedSeries, error)
GetTrendingTV returns trending TV series from TMDB. window must be "day" or "week" (defaults to "week").
func (*Client) SearchSeries ¶
SearchSeries searches TMDB for TV series matching query. If year is non-zero it is sent as the first_air_date_year filter.
type CrewMember ¶
CrewMember is a key crew entry (creator, EP, writer, director) from the credits append.
type EpisodeDetail ¶
type EpisodeDetail struct {
ID int
SeasonNumber int
EpisodeNumber int
Title string
Overview string
AirDate string
StillPath string
RuntimeMinutes int
}
EpisodeDetail holds per-episode metadata returned by /tv/{id}/season/{n}.
type ExternalIDs ¶
type ExternalIDs struct {
IMDBID string // "tt0903747"; empty when unknown
TVDBID int // 0 when unknown
}
ExternalIDs are a series' ids on other databases, as TMDB knows them.
type PaginatedSeries ¶
type PaginatedSeries struct {
Results []SearchResult
Page int
TotalPages int
}
PaginatedSeries is a page of series results from a TMDB list endpoint (popular, trending, top-rated, on-the-air, discover-by-genre).
type PersonCredit ¶
type PersonCredit struct {
TMDBID int
Title string
Year int
PosterPath string
Order int
// EpisodeCount is how many episodes the person appears in / worked on.
// Used to rank real roles above one-off talk-show / self appearances,
// since the cast `order` field is unreliable for TV.
EpisodeCount int
}
PersonCredit is a single TV series a person is credited on, from /person/{id}/tv_credits.
type SearchResult ¶
type SearchResult struct {
ID int
Title string
OriginalTitle string
Overview string
FirstAirDate string
Year int
PosterPath string
BackdropPath string
Popularity float64
VoteAverage float64
}
SearchResult is a single item from a /search/tv response.
type SeasonSummary ¶
SeasonSummary is a brief season entry embedded in SeriesDetail.
type SeriesDetail ¶
type SeriesDetail struct {
ID int
Title string
OriginalTitle string
Overview string
FirstAirDate string
Year int
RuntimeMinutes int
Genres []string
PosterPath string
BackdropPath string
// Status is one of "continuing", "ended", or "upcoming".
Status string
Network string
Seasons []SeasonSummary
// IMDBID ("tt...") and TVDBID come from external_ids; empty/zero when
// TMDB has none.
IMDBID string
TVDBID int
// The fields below are only populated by GetSeriesExtended (which
// requests append_to_response=credits,recommendations). GetSeries
// leaves them empty to keep the Add/RefreshMetadata payload light.
Rating float64
Cast []CastMember
Crew []CrewMember
Recommendations []SeriesRecommendation
}
SeriesDetail holds full series metadata returned by /tv/{id}.