tmdb

package
v0.1.104 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2024 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TMDBResultsPerPage reflects TMDB number of results on the page. It's statically set to 20, so we should work with that
	TMDBResultsPerPage = 20
)

Variables

View Source
var (
	WarmingUp = event.Event{}

	//                                                  Original    High    Medium  Low
	ImageQualitiesPoster    = []ImageQualityIdentifier{"original", "w780", "w500", "w342"}
	ImageQualitiesFanArt    = []ImageQualityIdentifier{"original", "w1280", "w1280", "w780"}
	ImageQualitiesThumbnail = []ImageQualityIdentifier{"original", "w1280", "w780", "w500"}
	ImageQualitiesLandscape = []ImageQualityIdentifier{"original", "w1280", "w780", "w500"}
)

Functions

func CheckAPIKey

func CheckAPIKey()

CheckAPIKey ...

func GetLocalizedImages

func GetLocalizedImages(images []*Image, imageQuality ImageQualityIdentifier) (localizedImage string, allImages []string, imagesWithText []string, imagesWithoutText []string)

GetLocalizedImages returns localized image, all images, images with text and images without text, so those can be used to set Kodi Arts To find localized image we use: user's language -> second language -> English.

func GetUserLanguages

func GetUserLanguages() (languagesList string)

GetUserLanguages returns list of user languages to be used with include_*_language query parameters

func ImageURL

func ImageURL(uri string, size ImageQualityIdentifier) (imageURL string)

ImageURL ...

func LogError

func LogError(err error)

LogError ...

func SetLocalizedArt

func SetLocalizedArt(video *Entity, item *xbmc.ListItem)

func SetTrailer added in v0.1.104

func SetTrailer(entity *Entity, item *xbmc.ListItem)

Types

type APIRequest

type APIRequest struct {
	URL         string
	Params      url.Values `msg:"-"`
	Result      interface{}
	ErrMsg      interface{}
	Description string
}

APIRequest ...

type AlternativeTitle

type AlternativeTitle struct {
	Iso3166_1 string `json:"iso_3166_1"`
	Title     string `json:"title"`
	Type      string `json:"type"`
}

AlternativeTitle ...

type ByPopularity

type ByPopularity Movies

ByPopularity ...

func (ByPopularity) Len

func (a ByPopularity) Len() int

func (ByPopularity) Less

func (a ByPopularity) Less(i, j int) bool

func (ByPopularity) Swap

func (a ByPopularity) Swap(i, j int)

type Cast

type Cast struct {
	IDName
	CastID      int    `json:"cast_id"`
	Character   string `json:"character"`
	CreditID    string `json:"credit_id"`
	Order       int    `json:"order"`
	ProfilePath string `json:"profile_path"`
}

Cast ...

type ContentRating

type ContentRating struct {
	Iso3166_1 string `json:"iso_3166_1"`
	Rating    string `json:"rating"`
}

ContentRating ...

type Country

type Country struct {
	Iso31661    string `json:"iso_3166_1"`
	Name        string `json:"name"`
	NativeName  string `json:"native_name"`
	EnglishName string `json:"english_name"`
}

Country ...

func GetCountries

func GetCountries(language string) []*Country

GetCountries ...

type CountryList

type CountryList []*Country

CountryList ...

type Credits

type Credits struct {
	Cast []*Cast `json:"cast"`
	Crew []*Crew `json:"crew"`
}

Credits ...

func (*Credits) GetCastMembers

func (credits *Credits) GetCastMembers() []xbmc.ListItemCastMember

GetCastMembers returns formatted cast members

func (*Credits) GetDirectors

func (credits *Credits) GetDirectors() []string

GetDirectors returns list of directors

func (*Credits) GetWriters

func (credits *Credits) GetWriters() []string

GetWriters returns list of writers

type Crew

type Crew struct {
	IDName
	CreditID    string `json:"credit_id"`
	Department  string `json:"department"`
	Job         string `json:"job"`
	ProfilePath string `json:"profile_path"`
}

Crew ...

type DiscoverFilters

type DiscoverFilters struct {
	Genre    string
	Country  string
	Language string
}

DiscoverFilters ...

type Entity

type Entity struct {
	BackdropPath     string    `json:"backdrop_path"`
	FirstAirDate     string    `json:"first_air_date"`
	Genres           []*IDName `json:"genres"`
	ID               int       `json:"id"`
	IsAdult          bool      `json:"adult"`
	Name             string    `json:"name,omitempty"`
	OriginalLanguage string    `json:"original_language,omitempty"`
	OriginalName     string    `json:"original_name,omitempty"`
	OriginalTitle    string    `json:"original_title,omitempty"`
	Overview         string    `json:"overview"`
	PosterPath       string    `json:"poster_path"`
	ReleaseDate      string    `json:"release_date"`
	Title            string    `json:"title,omitempty"`
	VoteAverage      float32   `json:"vote_average"`
	VoteCount        int       `json:"vote_count"`

	Images *Images `json:"images,omitempty"`

	Translations *struct {
		Translations []*Translation `json:"translations"`
	} `json:"translations"`

	Videos *struct {
		Videos []*Trailer `json:"results"`
	} `json:"videos"`

	Credits *Credits `json:"credits,omitempty"`

	ExternalIDs *ExternalIDs `json:"external_ids"`
}

Entity ...

type EntityList

type EntityList struct {
	Page         int       `json:"page"`
	Results      []*Entity `json:"results"`
	TotalPages   int       `json:"total_pages"`
	TotalResults int       `json:"total_results"`
}

EntityList ...

type Episode

type Episode struct {
	Entity

	AirDate       string `json:"air_date"`
	EpisodeNumber int    `json:"episode_number"`
	Runtime       int    `json:"runtime"`
	SeasonNumber  int    `json:"season_number"`
	StillPath     string `json:"still_path"`
}

Episode ...

func GetEpisode

func GetEpisode(showID int, seasonNumber int, episodeNumber int, language string) *Episode

GetEpisode ...

func (*Episode) GetLowestAirDate

func (episode *Episode) GetLowestAirDate(airDate string, airDateFormat string) (newAirDate string, newAirDateFormat string)

func (*Episode) GetName

func (episode *Episode) GetName(show *Show) string

func (*Episode) SetArt

func (episode *Episode) SetArt(show *Show, season *Season, item *xbmc.ListItem)

SetArt sets artworks for episode

func (*Episode) ToListItem

func (episode *Episode) ToListItem(show *Show, season *Season) *xbmc.ListItem

ToListItem ...

type EpisodeList

type EpisodeList []*Episode

EpisodeList ...

func (EpisodeList) ToListItems

func (episodes EpisodeList) ToListItems(show *Show, season *Season) []*xbmc.ListItem

ToListItems ...

type ExternalIDs

type ExternalIDs struct {
	IMDBId      string      `json:"imdb_id"`
	FreeBaseID  string      `json:"freebase_id"`
	FreeBaseMID string      `json:"freebase_mid"`
	TVDBID      interface{} `json:"tvdb_id"`
}

ExternalIDs ...

type FindResult

type FindResult struct {
	MovieResults     []*Entity `json:"movie_results"`
	PersonResults    []*Entity `json:"person_results"`
	TVResults        []*Entity `json:"tv_results"`
	TVEpisodeResults []*Entity `json:"tv_episode_results"`
	TVSeasonResults  []*Entity `json:"tv_season_results"`
}

FindResult ...

func Find

func Find(externalID string, externalSource string) *FindResult

Find ...

type Genre

type Genre IDName

Genre ...

func GetMovieGenres

func GetMovieGenres(language string) []*Genre

GetMovieGenres ...

func GetTVGenres

func GetTVGenres(language string) []*Genre

GetTVGenres ...

type GenreList

type GenreList struct {
	Genres []*Genre `json:"genres"`
}

GenreList ...

type IDName

type IDName struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

IDName ...

type IDNameLogo struct {
	ID            int    `json:"id"`
	Name          string `json:"name"`
	OriginCountry string `json:"origin_country"`
}

IDNameLogo ...

type Image

type Image struct {
	FilePath string `json:"file_path"`
	Height   int    `json:"height"`
	Iso639_1 string `json:"iso_639_1"`
	Width    int    `json:"width"`
}

Image ...

type ImageQualityBundle

type ImageQualityBundle struct {
	Poster    ImageQualityIdentifier
	FanArt    ImageQualityIdentifier
	Thumbnail ImageQualityIdentifier
	Landscape ImageQualityIdentifier
}

ImageQualityBundle contains image qualities for different type of images

func GetImageQualities

func GetImageQualities() (imageQualities ImageQualityBundle)

type ImageQualityIdentifier

type ImageQualityIdentifier string

ImageQualityIdentifier contains the image quality as a string, e.g. "w1280"

type Images

type Images struct {
	Backdrops []*Image `json:"backdrops"`
	Posters   []*Image `json:"posters"`
	Stills    []*Image `json:"stills"`
	Logos     []*Image `json:"logos"`
}

Images ...

func GetEpisodeImages

func GetEpisodeImages(showID, season, episode int) *Images

GetEpisodeImages ...

func GetImages

func GetImages(movieID int) *Images

GetImages ...

func GetSeasonImages

func GetSeasonImages(showID int, season int) *Images

GetSeasonImages ...

func GetShowImages

func GetShowImages(showID int) *Images

GetShowImages ...

type Language

type Language struct {
	Iso639_1    string `json:"iso_639_1"`
	Name        string `json:"name"`
	EnglishName string `json:"english_name,omitempty"`
}

Language ...

func GetLanguages

func GetLanguages(language string) []*Language

GetLanguages ...

type LanguageList

type LanguageList struct {
	Languages []*Language `json:"languages"`
}

LanguageList ...

type List

type List struct {
	CreatedBy     string    `json:"created_by"`
	Description   string    `json:"description"`
	FavoriteCount int       `json:"favorite_count"`
	ID            int       `json:"id"`
	ItemCount     int       `json:"item_count"`
	Iso639_1      string    `json:"iso_639_1"`
	Name          string    `json:"name"`
	PosterPath    string    `json:"poster_path"`
	Items         []*Entity `json:"items"`
}

List ...

type Movie

type Movie struct {
	Entity

	FanArt              *fanart.Movie `json:"fanart"`
	IMDBId              string        `json:"imdb_id"`
	Popularity          float64       `json:"-"`
	ProductionCompanies []*IDNameLogo `json:"production_companies"`
	ProductionCountries []*Country    `json:"production_countries"`
	RawPopularity       interface{}   `json:"popularity"`
	Runtime             int           `json:"runtime"`
	SpokenLanguages     []*Language   `json:"spoken_languages"`
	TagLine             string        `json:"tagline"`

	AlternativeTitles *struct {
		Titles []*AlternativeTitle `json:"titles"`
	} `json:"alternative_titles"`

	ReleaseDates *ReleaseDatesResults `json:"release_dates"`
}

Movie ...

func GetMovie

func GetMovie(tmdbID int, language string) *Movie

GetMovie ...

func GetMovieByID

func GetMovieByID(movieID string, language string) *Movie

GetMovieByID ...

func (*Movie) GetCountries

func (movie *Movie) GetCountries() []string

GetCountries returns list of countries

func (*Movie) GetGenres

func (movie *Movie) GetGenres() []string

GetGenres returns list of genres

func (*Movie) GetStudios

func (movie *Movie) GetStudios() []string

GetStudios returns list of studios

func (*Movie) GetTitle

func (movie *Movie) GetTitle() string

func (*Movie) SetArt

func (movie *Movie) SetArt(item *xbmc.ListItem)

SetArt sets artworks for movie

func (*Movie) ToListItem

func (movie *Movie) ToListItem() *xbmc.ListItem

ToListItem ...

func (*Movie) Year

func (movie *Movie) Year() int

Year returns year of the movie

type Movies

type Movies []*Movie

Movies ...

func GetIMDBList

func GetIMDBList(listID string, language string, page int) (movies Movies, totalResults int)

GetIMDBList ...

func GetMovies

func GetMovies(tmdbIds []int, language string) Movies

GetMovies ...

func MostVotedMovies

func MostVotedMovies(genre string, language string, page int) (Movies, int)

MostVotedMovies ...

func PopularMovies

func PopularMovies(params DiscoverFilters, language string, page int) (Movies, int)

PopularMovies ...

func RecentMovies

func RecentMovies(params DiscoverFilters, language string, page int) (Movies, int)

RecentMovies ...

func SearchMovies

func SearchMovies(query string, language string, page int) (Movies, int)

SearchMovies ...

func TopRatedMovies

func TopRatedMovies(genre string, language string, page int) (Movies, int)

TopRatedMovies ...

type ReleaseDate

type ReleaseDate struct {
	Certification string `json:"certification"`
	Iso639_1      string `json:"iso_639_1"`
	Note          string `json:"note"`
	ReleaseDate   string `json:"release_date"`
	Type          int    `json:"type"`
}

ReleaseDate ...

type ReleaseDates

type ReleaseDates struct {
	Iso3166_1    string         `json:"iso_3166_1"`
	ReleaseDates []*ReleaseDate `json:"release_dates"`
}

ReleaseDates ...

type ReleaseDatesResults

type ReleaseDatesResults struct {
	Results []*ReleaseDates `json:"results"`
}

ReleaseDatesResults ...

type Season

type Season struct {
	Entity

	AirDate      string `json:"air_date"`
	EpisodeCount int    `json:"episode_count,omitempty"`
	Season       int    `json:"season_number"`

	Episodes EpisodeList `json:"episodes"`
}

Season ...

func GetSeason

func GetSeason(showID int, seasonNumber int, language string, seasonsCount int, includeEpisodes bool) *Season

GetSeason ...

func (*Season) CountEpisodesNumber

func (season *Season) CountEpisodesNumber(show *Show) (episodes int)

CountEpisodesNumber returns number of episodes

func (*Season) CountWatchedEpisodesNumber

func (season *Season) CountWatchedEpisodesNumber(show *Show) (watchedEpisodes int)

CountWatchedEpisodesNumber returns number of watched episodes

func (*Season) GetEpisode

func (season *Season) GetEpisode(episode int) *Episode

GetEpisode gets episode with specific number from Episodes list

func (*Season) GetName

func (season *Season) GetName(show *Show) string

func (*Season) HasEpisode

func (season *Season) HasEpisode(episode int) bool

HasEpisode checks if episode with specific number is available in the episodes list

func (*Season) SetArt

func (season *Season) SetArt(show *Show, item *xbmc.ListItem)

SetArt sets artworks for season

func (*Season) ToListItem

func (season *Season) ToListItem(show *Show) *xbmc.ListItem

ToListItem ...

type SeasonList

type SeasonList []*Season

SeasonList ...

func (SeasonList) Len

func (seasons SeasonList) Len() int

func (SeasonList) Less

func (seasons SeasonList) Less(i, j int) bool

func (SeasonList) Swap

func (seasons SeasonList) Swap(i, j int)

func (SeasonList) ToListItems

func (seasons SeasonList) ToListItems(show *Show) []*xbmc.ListItem

ToListItems ...

type Show

type Show struct {
	Entity

	EpisodeRunTime      []int         `json:"episode_run_time"`
	FanArt              *fanart.Show  `json:"fanart"`
	Homepage            string        `json:"homepage"`
	InProduction        bool          `json:"in_production"`
	LastAirDate         string        `json:"last_air_date"`
	Networks            []*IDNameLogo `json:"networks"`
	NumberOfEpisodes    int           `json:"number_of_episodes"`
	NumberOfSeasons     int           `json:"number_of_seasons"`
	OriginCountry       []string      `json:"origin_country"`
	Popularity          float64       `json:"-"`
	ProductionCompanies []*IDNameLogo `json:"production_companies"`
	ProductionCountries []*Country    `json:"production_countries"`
	RawPopularity       interface{}   `json:"popularity"`
	SpokenLanguages     []*Language   `json:"spoken_languages"`
	Status              string        `json:"status"`
	TagLine             string        `json:"tagline"`

	LastEpisodeToAir *Episode `json:"last_episode_to_air"`
	NextEpisodeToAir *Episode `json:"next_episode_to_air"`

	AlternativeTitles *struct {
		Titles []*AlternativeTitle `json:"results"`
	} `json:"alternative_titles"`

	ContentRatings *struct {
		Ratings []*ContentRating `json:"results"`
	} `json:"content_ratings"`

	Seasons SeasonList `json:"seasons"`
}

Show ...

func GetShow

func GetShow(showID int, language string) (show *Show)

GetShow ...

func GetShowByID

func GetShowByID(tmdbID string, language string) *Show

GetShowByID ...

func (*Show) CountEpisodesNumber

func (show *Show) CountEpisodesNumber() (episodes int)

CountEpisodesNumber returns number of episodes taking into account unaired and special

func (*Show) CountRealSeasons

func (show *Show) CountRealSeasons() int

CountRealSeasons counts real seasons, meaning without specials.

func (*Show) CountWatchedEpisodesNumber

func (show *Show) CountWatchedEpisodesNumber() (watchedEpisodes int)

CountWatchedEpisodesNumber returns number of watched episodes

func (*Show) EnsureSeason

func (show *Show) EnsureSeason(season int) *Season

func (*Show) EpisodesTillSeason

func (show *Show) EpisodesTillSeason(season int) int

EpisodesTillSeason counts how many episodes exist before this season.

func (*Show) GetCountries

func (show *Show) GetCountries() []string

GetCountries returns list of countries

func (*Show) GetGenres

func (show *Show) GetGenres() []string

GetGenres returns list of genres

func (*Show) GetName

func (show *Show) GetName() string

func (*Show) GetNetworks

func (show *Show) GetNetworks() []string

GetNetworks returns list of networks

func (*Show) GetProductionCompanies

func (show *Show) GetProductionCompanies() []string

GetProductionCompanies returns list of production companies

func (*Show) GetSeasonAirDate

func (show *Show) GetSeasonAirDate(season int) time.Time

func (*Show) GetSeasonByRealNumber

func (show *Show) GetSeasonByRealNumber(season int) *Season

GetSeasonByRealNumber returns season object corresponding to real season number.

func (*Show) GetSeasonEpisodes

func (show *Show) GetSeasonEpisodes(season int) int

GetSeasonEpisodes ...

func (*Show) GetStudios

func (show *Show) GetStudios() []string

GetStudios returns list of studios

func (*Show) IsAnime

func (show *Show) IsAnime() bool

IsAnime ...

func (*Show) IsSeasonAired

func (show *Show) IsSeasonAired(season int) bool

func (*Show) SetArt

func (show *Show) SetArt(item *xbmc.ListItem)

SetArt sets artworks for show

func (*Show) ShowInfo

func (show *Show) ShowInfo(episode *Episode) (an int, st string)

ShowInfo returns absolute episode number and show title

func (*Show) ShowInfoWithTVDBShow

func (show *Show) ShowInfoWithTVDBShow(episode *Episode, tvdbShow *tvdb.Show) (an int, st string)

ShowInfoWithTVDBShow ...

func (*Show) ToListItem

func (show *Show) ToListItem() *xbmc.ListItem

ToListItem ...

type Shows

type Shows []*Show

Shows ...

func GetShows

func GetShows(showIds []int, language string) Shows

GetShows ...

func MostVotedShows

func MostVotedShows(genre string, language string, page int) (Shows, int)

MostVotedShows ...

func PopularShows

func PopularShows(params DiscoverFilters, language string, page int) (Shows, int)

PopularShows ...

func RecentEpisodes

func RecentEpisodes(params DiscoverFilters, language string, page int) (Shows, int)

RecentEpisodes ...

func RecentShows

func RecentShows(params DiscoverFilters, language string, page int) (Shows, int)

RecentShows ...

func SearchShows

func SearchShows(query string, language string, page int) (Shows, int)

SearchShows ...

func TopRatedShows

func TopRatedShows(genre string, language string, page int) (Shows, int)

TopRatedShows ...

type Trailer

type Trailer struct {
	Name string `json:"name"`
	Key  string `json:"key"`
	Type string `json:"type"`
	Site string `json:"site"`
}

Trailer ...

type Translation

type Translation struct {
	Iso3166_1   string           `json:"iso_3166_1"`
	Iso639_1    string           `json:"iso_639_1"`
	Name        string           `json:"name"`
	EnglishName string           `json:"english_name"`
	Data        *TranslationData `json:"data"`
}

Translation ...

type TranslationData

type TranslationData struct {
	Name     string `json:"name"`
	Title    string `json:"title"`
	Overview string `json:"overview"`
	Homepage string `json:"homepage"`
	TagLine  string `json:"tagline"`
}

TranslationData ...

Jump to

Keyboard shortcuts

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