metadata

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 12, 2026 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PosterURL

func PosterURL(path, size string) string

func TVDBArtworkURL

func TVDBArtworkURL(p string) string

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 CastMember struct {
	TMDBID     uint32
	Name       string
	Character  string
	ProfileURL string
	// PersonURL links to the person's page on the source provider. Empty for
	// TMDB cast (the URL is derived from TMDBID); set directly for TVDB cast.
	PersonURL string
}

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 MovieResult struct {
	TMDBID        uint32
	Title         string
	OriginalTitle string
	Year          uint16
	Overview      string
	PosterPath    string
}

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

type SeasonInfo struct {
	Number uint16
	Name   string
}

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) GetMovie

func (t *TMDB) GetMovie(ctx context.Context, tmdbID uint32) (*MovieDetails, error)

func (*TMDB) Recommendations

func (t *TMDB) Recommendations(
	ctx context.Context,
	tmdbID uint32,
) ([]MovieResult, error)

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

func (t *TMDB) SearchMovie(
	ctx context.Context,
	query string,
	year uint16,
) ([]MovieResult, error)

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) GetSeries

func (t *TVDB) GetSeries(ctx context.Context, tvdbID uint32) (*TVDetails, error)

func (*TVDB) GetSeriesCast

func (t *TVDB) GetSeriesCast(
	ctx context.Context,
	tvdbID uint32,
) ([]CastMember, error)

GetSeriesCast returns up to maxCastMembers actors for a series, ordered by TVDB's `sort`. Non-actor crew (directors, writers, …) is skipped.

func (*TVDB) SearchSeries

func (t *TVDB) SearchSeries(ctx context.Context, query string) ([]TVResult, error)

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.

type TVResult

type TVResult struct {
	TVDBID        uint32
	Title         string
	OriginalTitle string // untranslated TVDB name; blank when no language override
	Year          uint16
	Network       string
	Overview      string
	PosterPath    string
}

TVResult is a single TVDB search hit.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL