Documentation
¶
Overview ¶
Package moviedata looks films and shows up at The Movie Database and keeps what it finds: the fields of them that are read, and searches, in a SQLite database, their images as files beside it. What is once fetched is answered from there ever after, so a program asks this package, never The Movie Database's client directly.
Index ¶
- Constants
- func Path() (string, error)
- type Client
- func (c *Client) Close() error
- func (c *Client) Episode(ctx context.Context, id ShowID, n, e int32) (Episode, error)
- func (c *Client) Find(ctx context.Context, title string, year int) (Movie, bool, error)
- func (c *Client) FindShow(ctx context.Context, name string) (Show, bool, error)
- func (c *Client) Movie(ctx context.Context, id MovieID) (Movie, error)
- func (c *Client) Poster(ctx context.Context, id MovieID) (string, error)
- func (c *Client) Search(ctx context.Context, query string) ([]Movie, error)
- func (c *Client) SearchShows(ctx context.Context, query string) ([]Show, error)
- func (c *Client) Show(ctx context.Context, id ShowID) (Show, error)
- func (c *Client) ShowPoster(ctx context.Context, id ShowID, n int32) (string, error)
- func (c *Client) Still(ctx context.Context, id ShowID, n, e int32) (string, error)
- type Episode
- type Movie
- type MovieID
- type Show
- type ShowID
Constants ¶
const DebugFile = "debug/themoviedb.json"
DebugFile is where the responses the client cannot decode are added, for it to learn from, relative to the working directory.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client answers from what it keeps, and fetches from The Movie Database what it does not keep yet.
Where something does not exist, at The Movie Database or among a season's episodes or a film's images, the error it returns is fs.ErrNotExist.
func Open ¶
Open opens the database at path, creating it where it does not exist, and keeps images in the directory beside it.
Without TMDB_API_TOKEN set it still opens: what is kept is answered, and fetching what is not fails.
func (*Client) Find ¶
Find is the best match for a film's title and year (0 for unknown): the first result for both, else for the title alone.
func (*Client) SearchShows ¶
SearchShows is the shows for query, best first.
func (*Client) ShowPoster ¶
ShowPoster is the file the poster of season n of show id is kept in, else the show's, for n 0 or a season without one.
type Episode ¶
type Episode struct {
ShowID ShowID
SeasonNumber int32
EpisodeNumber int32
Name string
Overview string
AirDate civil.Date // zero where unknown
Runtime int // minutes
VoteAverage float64
StillPath string // empty where it has none
}
Episode is an episode of a show, as The Movie Database has it.
type Movie ¶
type Movie struct {
ID MovieID
Title string
OriginalTitle string
OriginalLanguage string
Overview string
ReleaseDate civil.Date // zero where unknown
Popularity float64
VoteAverage float64
VoteCount int
PosterPath string // empty where it has none
}
Movie is a film, as The Movie Database has it.
type Show ¶
type Show struct {
ID ShowID
Name string
OriginalName string
OriginalLanguage string
Overview string
FirstAirDate civil.Date // zero where unknown
Popularity float64
VoteAverage float64
VoteCount int
PosterPath string // empty where it has none
}
Show is a show, as The Movie Database has it.