tmdb

package module
v0.0.0-...-22e4e98 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2026 License: MPL-2.0 Imports: 9 Imported by: 0

README

tmdb

Package tmdb provides a client for the TMDB (The Movie Database) API at http://api.themoviedb.org that can search for Films and TV series episodes. You will need a TVDB API key in order to use this package.

usage

Simple usage example:

key := "[my api key]"
client, err := tmdb.New(key)
if err != nil {
    log.Print(err)
}
film, err := client.SearchFilm("The Matrix", 1999, "")
if err != nil {
    log.Print(err)
}
// Do something with film here.

installation

You can add package tmdb to your project using a regular import, as it is written in pure Go (no C/C++). Dependencies will be pulled in automatically by go mod.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	ApiKey string
	// contains filtered or unexported fields
}

Client represents a TMDB client.

func New

func New(apiKey string) (*Client, error)

New returns a TMDB client with the specified apikey.

func (*Client) GetEpisode

func (c *Client) GetEpisode(showID int, season int, number int, language string) (*Episode, error)

GetEpisode returns an Episode with season and number for the provided TMDB show ID, and optional ISO3166-1 alpha2 language code.

func (*Client) GetFilm

func (c *Client) GetFilm(id int, language string) (*Film, error)

GetFilm returns a Film by provided TMDB id, and optional ISO3166-1 alpha2 language code.

func (*Client) GetShow

func (c *Client) GetShow(id int, language string) (*Show, error)

GetShow returns a Show by provided TMDB id, and optional ISO3166-1 alpha2 language code.

func (*Client) SearchFilm

func (c *Client) SearchFilm(title string, year int, language string) (*Film, error)

SearchFilm returns a Film by provided title, year, and optional ISO3166-1 alpha2 language code.

func (*Client) SearchShow

func (c *Client) SearchShow(title string, language string) (*Show, error)

SearchShow returns a Show by provided title, and optional ISO3166-1 alpha2 language code.

type Episode

type Episode struct {
	ID        int        `json:"id"`
	Premiered dates.Date `json:"air_date"`
	Title     string     `json:"name"`
	Overview  string     `json:"overview"`
	Season    int        `json:"season_number"`
	Number    int        `json:"episode_number"`
	Image     string     `json:"still_path"`
	Rating    float64    `json:"vote_average"`
	Votes     int        `json:"vote_count"`
}

type Film

type Film struct {
	ID               int        `json:"id"`
	Title            string     `json:"title"`
	Premiered        dates.Date `json:"release_date"`
	Overview         string     `json:"overview"`
	OriginalTitle    string     `json:"original_title"`
	OriginalLanguage string     `json:"original_language"`
	Rating           float64    `json:"vote_average"`
	Popularity       float64    `json:"popularity"`
	Votes            int        `json:"vote_count"`
	Poster           string     `json:"poster_path"`
	Backdrop         string     `json:"backdrop_path"`
	Genres           []string
}

Film represents a film.

type Show

type Show struct {
	ID               int        `json:"id"`
	Title            string     `json:"name"`
	Premiered        dates.Date `json:"first_air_date"`
	Overview         string     `json:"overview"`
	OriginalTitle    string     `json:"original_name"`
	OriginCountry    []string   `json:"origin_country"`
	OriginalLanguage string     `json:"original_language"`
	Rating           float64    `json:"vote_average"`
	Popularity       float64    `json:"popularity"`
	Votes            int        `json:"vote_count"`
	Poster           string     `json:"poster_path"`
	Backdrop         string     `json:"backdrop_path"`
	Genres           []string
}

Show represents a tv show.

Jump to

Keyboard shortcuts

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