Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( NoResults = errors.New("no results") UnsupportedMediaType = errors.New("unsupported media type") )
Functions ¶
This section is empty.
Types ¶
type Movie ¶
type Movie struct {
ID int64 `json:"id"`
Title string `json:"title"`
Year int `json:"year"`
Path string `json:"path"`
IsDir bool `json:"isDir"`
Language string `json:"language"`
OriginalName string `json:"originalName"`
Error string `json:"error,omitempty"`
}
func Best ¶
func Best(searchMovies *gotmdb.SearchMovies) (*Movie, error)
Best return the first movie from the results. First one is considered best because searchMovies.Results response from the api is ordered with best matches first.
func BestByYear ¶
func BestByYear(searchMovies *gotmdb.SearchMovies, year int) (*Movie, error)
BestByYear return the best match for year.
Best match is computed by selecting the result with best "score". score = delta * index (the smaller the better) delta = math.Abs(movie.ReleaseDate.Year - year) (the smaller the better) index = index in the search results (the smaller the better)
both delta and index are increased by 1 to avoid an entry being considered best because it is first (index=0) or matches exact year (delta=0, but index=499) searchMovies.Results entries are ordered with best matches first (0 is good, 499 is bad).
func (*Movie) ComputePath ¶
Path computes the ideal path for a movie given its title and year.
type Multi ¶ added in v0.2.0
type Multi struct {
ID int64 `json:"id"`
Title string `json:"title"`
Year int `json:"year"`
Path string `json:"path"`
IsDir bool `json:"isDir"`
Language string `json:"language"`
OriginalName string `json:"originalName"`
MediaType string `json:"mediaType"`
Error string `json:"error,omitempty"`
}
func BestByYearMulti ¶ added in v0.2.0
func BestByYearMulti(searchMovies *gotmdb.SearchMulti, year int) (*Multi, error)
BestByYear return the best match for year.
Best match is computed by selecting the result with best "score". score = delta * index (the smaller the better) delta = math.Abs(movie.ReleaseDate.Year - year) (the smaller the better) index = index in the search results (the smaller the better)
both delta and index are increased by 1 to avoid an entry being considered best because it is first (index=0) or matches exact year (delta=0, but index=499) searchMovies.Results entries are ordered with best matches first (0 is good, 499 is bad).
func BestMulti ¶ added in v0.2.0
func BestMulti(searchMovies *gotmdb.SearchMulti) (*Multi, error)
Best return the first movie from the results. First one is considered best because searchMovies.Results response from the api is ordered with best matches first.
func (*Multi) ComputePath ¶ added in v0.2.0
Path computes the ideal path for a movie given its title and year.