movie

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NoResults = errors.New("no results")

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

func (m *Movie) ComputePath() bool

Path computes the ideal path for a movie given its title and year.

Jump to

Keyboard shortcuts

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