Documentation
¶
Index ¶
- func PosterURL(path, size string) string
- func TVDBArtworkURL(p string) string
- type CastMember
- type EpisodeInfo
- type MovieDetails
- type MovieResult
- type Provider
- type SeasonInfo
- type SeriesType
- type TMDB
- func (t *TMDB) FetchDigitalRelease(ctx context.Context, tmdbID uint32, region string) (*time.Time, error)
- func (t *TMDB) GetMovie(ctx context.Context, tmdbID uint32) (*MovieDetails, error)
- func (t *TMDB) Recommendations(ctx context.Context, tmdbID uint32) ([]MovieResult, error)
- func (t *TMDB) SearchMovie(ctx context.Context, query string, year uint16) ([]MovieResult, error)
- type TVDB
- type TVDetails
- type TVProvider
- type TVResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TVDBArtworkURL ¶
TVDBArtworkURL returns an absolute URL for a TVDB image reference. TVDB image fields are usually already absolute; relative paths are prefixed with the TVDB artwork host. Empty in, empty out.
Types ¶
type CastMember ¶
type EpisodeInfo ¶
type EpisodeInfo struct {
SeasonNumber uint16
Number uint16
AbsoluteNumber uint16
Title string
Overview string
AirDate *time.Time // nil when TVDB has no date (unaired/unknown)
}
EpisodeInfo is one episode as TVDB reports it.
type MovieDetails ¶
type MovieDetails struct {
MovieResult
Genres []string
Runtime uint16
// Rating is TMDB's vote average (0–10). Zero when TMDB has no votes.
Rating float32
Cast []CastMember
}
type MovieResult ¶
type Provider ¶
type Provider interface {
SearchMovie(
ctx context.Context,
query string,
year uint16,
) ([]MovieResult, error)
GetMovie(ctx context.Context, tmdbID uint32) (*MovieDetails, error)
// Recommendations returns TMDB's "recommended" movies for the given
// title, capped and ordered as TMDB returns them.
Recommendations(ctx context.Context, tmdbID uint32) ([]MovieResult, error)
// FetchDigitalRelease returns the earliest digital-type (TMDB type 4)
// release date for the given region, or (nil, nil) when none is published.
FetchDigitalRelease(
ctx context.Context,
tmdbID uint32,
region string,
) (*time.Time, error)
}
type SeasonInfo ¶
SeasonInfo is a season summary (episodes are carried flat on TVDetails).
type SeriesType ¶
type SeriesType string
SeriesType mirrors the schema enum values.
const ( SeriesStandard SeriesType = "standard" SeriesAnime SeriesType = "anime" SeriesDaily SeriesType = "daily" )
type TMDB ¶
type TMDB struct {
BaseURL string
// contains filtered or unexported fields
}
func NewTMDB ¶
func NewTMDB() *TMDB
NewTMDB builds a TMDB client using the api key and language from the config singleton (metadata.tmdb_api_key, metadata.language). An empty metadata.language leaves the language param off requests, letting TMDB fall back to its provider default.
func (*TMDB) FetchDigitalRelease ¶
func (t *TMDB) FetchDigitalRelease( ctx context.Context, tmdbID uint32, region string, ) (*time.Time, error)
FetchDigitalRelease returns the earliest digital-type (TMDB type 4) release date for the given region, or (nil, nil) when none is published.
func (*TMDB) Recommendations ¶
Recommendations returns TMDB's "recommended" movies for the given title. The response shares the search-result shape, so it maps through the same MovieResult projection.
func (*TMDB) SearchMovie ¶
type TVDB ¶
type TVDB struct {
BaseURL string
// contains filtered or unexported fields
}
func NewTVDB ¶
func NewTVDB() *TVDB
NewTVDB builds a TVDB client from metadata.tvdb_api_key in the config singleton. The token is fetched lazily on first request.
func (*TVDB) GetSeriesCast ¶
GetSeriesCast returns up to maxCastMembers actors for a series, ordered by TVDB's `sort`. Non-actor crew (directors, writers, …) is skipped.
type TVDetails ¶
type TVDetails struct {
TVResult
Status string // "continuing" | "ended" | "upcoming"
Type SeriesType
Creator string
Runtime uint16
Rating float32
Genres []string
Cast []CastMember
Seasons []SeasonInfo
Episodes []EpisodeInfo
}
TVDetails is the full TVDB record used to seed a show + its seasons/episodes.
type TVProvider ¶
type TVProvider interface {
SearchSeries(ctx context.Context, query string) ([]TVResult, error)
GetSeries(ctx context.Context, tvdbID uint32) (*TVDetails, error)
// GetSeriesCast returns top-billed actors for a series. Cheaper than
// GetSeries: one extended-record fetch, no episode pagination.
GetSeriesCast(ctx context.Context, tvdbID uint32) ([]CastMember, error)
}
TVProvider fetches TV-series metadata. Implemented by *TVDB.