engine

package
v1.2.9 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2025 License: Apache-2.0 Imports: 61 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultEngineName     = "metatube"
	DefaultRequestTimeout = time.Minute
)
View Source
const (
	ActorProviderPriorityEnvPrefix = "MT_ACTOR_PROVIDER_PRIORITY_"
	MovieProviderPriorityEnvPrefix = "MT_MOVIE_PROVIDER_PRIORITY_"
)

Special environment prefixes for setting provider priorities.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

type Engine struct {
	// contains filtered or unexported fields
}

func Default

func Default() *Engine

func New

func New(db *gorm.DB, opts ...Option) *Engine

func (*Engine) DBAutoMigrate added in v1.2.7

func (e *Engine) DBAutoMigrate(v bool) error

func (*Engine) DBType added in v1.2.7

func (e *Engine) DBType() string

func (*Engine) DBVersion added in v1.2.7

func (e *Engine) DBVersion() (version string, err error)

func (*Engine) Fetch

func (e *Engine) Fetch(url string, provider mt.Provider) (*http.Response, error)

Fetch fetches content from url. If provider is nil, the default fetcher will be used.

func (*Engine) GetActorInfoByProviderID

func (e *Engine) GetActorInfoByProviderID(name, id string, lazy bool) (*model.ActorInfo, error)

func (*Engine) GetActorInfoByURL

func (e *Engine) GetActorInfoByURL(rawURL string, lazy bool) (*model.ActorInfo, error)

func (*Engine) GetActorPrimaryImage

func (e *Engine) GetActorPrimaryImage(name, id string) (image.Image, error)

func (*Engine) GetActorProviderByName

func (e *Engine) GetActorProviderByName(name string) (mt.ActorProvider, error)

func (*Engine) GetActorProviderByURL

func (e *Engine) GetActorProviderByURL(rawURL string) (mt.ActorProvider, error)

func (*Engine) GetActorProviders

func (e *Engine) GetActorProviders() map[string]mt.ActorProvider

func (*Engine) GetImageByURL

func (e *Engine) GetImageByURL(provider mt.Provider, url string, ratio, pos float64, auto bool) (img image.Image, err error)

func (*Engine) GetMovieBackdropImage

func (e *Engine) GetMovieBackdropImage(name, id string) (image.Image, error)

func (*Engine) GetMovieInfoByProviderID

func (e *Engine) GetMovieInfoByProviderID(name, id string, lazy bool) (*model.MovieInfo, error)

func (*Engine) GetMovieInfoByURL

func (e *Engine) GetMovieInfoByURL(rawURL string, lazy bool) (*model.MovieInfo, error)

func (*Engine) GetMoviePrimaryImage

func (e *Engine) GetMoviePrimaryImage(name, id string, ratio, pos float64) (image.Image, error)

func (*Engine) GetMovieProviderByName

func (e *Engine) GetMovieProviderByName(name string) (mt.MovieProvider, error)

func (*Engine) GetMovieProviderByURL

func (e *Engine) GetMovieProviderByURL(rawURL string) (mt.MovieProvider, error)

func (*Engine) GetMovieProviders

func (e *Engine) GetMovieProviders() map[string]mt.MovieProvider

func (*Engine) GetMovieReviewsByProviderID added in v1.2.0

func (e *Engine) GetMovieReviewsByProviderID(name, id string, lazy bool) (*model.MovieReviewInfo, error)

func (*Engine) GetMovieReviewsByProviderURL added in v1.2.0

func (e *Engine) GetMovieReviewsByProviderURL(name, rawURL string, lazy bool) (*model.MovieReviewInfo, error)

func (*Engine) GetMovieThumbImage

func (e *Engine) GetMovieThumbImage(name, id string) (image.Image, error)

func (*Engine) IsActorProvider

func (e *Engine) IsActorProvider(name string) (ok bool)

func (*Engine) IsMovieProvider

func (e *Engine) IsMovieProvider(name string) (ok bool)

func (*Engine) MustGetActorProviderByName

func (e *Engine) MustGetActorProviderByName(name string) mt.ActorProvider

func (*Engine) MustGetMovieProviderByName

func (e *Engine) MustGetMovieProviderByName(name string) mt.MovieProvider

func (*Engine) SearchActor

func (e *Engine) SearchActor(keyword, name string, fallback bool) ([]*model.ActorSearchResult, error)

func (*Engine) SearchActorAll

func (e *Engine) SearchActorAll(keyword string, fallback bool) (results []*model.ActorSearchResult, err error)

func (*Engine) SearchMovie

func (e *Engine) SearchMovie(keyword, name string, fallback bool) ([]*model.MovieSearchResult, error)

func (*Engine) SearchMovieAll

func (e *Engine) SearchMovieAll(keyword string, fallback bool) (results []*model.MovieSearchResult, err error)

SearchMovieAll searches the keyword from all providers.

func (*Engine) String added in v1.2.7

func (e *Engine) String() string

String returns the name of the Engine instance.

type Option added in v1.2.7

type Option func(*Engine)

func WithEngineName added in v1.2.7

func WithEngineName(name string) Option

func WithRequestTimeout added in v1.2.7

func WithRequestTimeout(timeout time.Duration) Option

Jump to

Keyboard shortcuts

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