elastictv

package
v0.0.0-...-fd8038a Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2023 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MovieType  = "movie"
	TVShowType = "tv"
)
View Source
const (
	TitleAttribute    = "title"
	DirectorAttribute = "director"
	ActorAttribute    = "actor"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Credits

type Credits struct {
	Actor    []string `json:"actor,omitempty"`
	Director []string `json:"director,omitempty"`
	Other    []string `json:"other,omitempty"`
}

type Description

type Description struct {
	Source string `json:"source,omitempty"`
	Text   string `json:"text,omitempty"`
}

type ElasticTV

type ElasticTV struct {
	Client    *elasticsearch.Client
	Providers []SearchableProvider
	Index     index
}

func New

func New() (*ElasticTV, error)

func (*ElasticTV) AddProvider

func (estv *ElasticTV) AddProvider(p SearchableProvider) error

func (ElasticTV) GetRecordID

func (estv ElasticTV) GetRecordID(query *Query, index string) (string, error)

func (ElasticTV) IndexSearchTitle

func (estv ElasticTV) IndexSearchTitle(params SearchTitlesParams) error

func (ElasticTV) LookupEpisode

func (estv ElasticTV) LookupEpisode(params LookupEpisodeParams) (*Title, *Episode, float64, error)

func (ElasticTV) LookupMovie

func (estv ElasticTV) LookupMovie(params LookupMovieParams) (*Title, float64, error)

func (ElasticTV) RefreshIndices

func (estv ElasticTV) RefreshIndices() error

func (ElasticTV) UpsertEpisode

func (estv ElasticTV) UpsertEpisode(episode Episode) error

func (ElasticTV) UpsertTitle

func (estv ElasticTV) UpsertTitle(title Title) error

type Episode

type Episode struct {
	AirDate     string      `json:"air_date,omitempty"`
	Description Description `json:"description"`
	IDs         IDs         `json:"ids"`
	Image       string      `json:"image,omitempty"`
	Rating      *Rating     `json:"rating,omitempty"`
	Timestamp   string      `json:"@timestamp"`
	Title       string      `json:"title"`
	TVShowID    int         `json:"tvshow_id,omitempty"`
	Episode     uint16      `json:"episode"`
	Season      uint16      `json:"season"`
}

type IDs

type IDs struct {
	IMDb string `json:"imdb,omitempty"`
	TMDb int    `json:"tmdb,omitempty"`
}

type LookupCommonParams

type LookupCommonParams struct {
	Title    []string
	Director []string
	Actor    []string
	Other    []string
	Country  []string
	Genre    []string
	IMDBID   string
}

type LookupEpisodeParams

type LookupEpisodeParams struct {
	LookupCommonParams
	EpisodeTitle string
	Season       uint16
	Episode      uint16
}

type LookupMovieParams

type LookupMovieParams struct {
	LookupCommonParams
	Year uint16
}

type Query

type Query struct {
	Query struct {
		Bool struct {
			Should []interface{} `json:"should,omitempty"`
			Must   []interface{} `json:"must,omitempty"`
		} `json:"bool"`
	} `json:"query"`
}

func NewQuery

func NewQuery() *Query

func (*Query) WithActors

func (q *Query) WithActors(names ...string) *Query

func (*Query) WithCountries

func (q *Query) WithCountries(countries ...string) *Query

func (*Query) WithDirectors

func (q *Query) WithDirectors(names ...string) *Query

func (*Query) WithEpisodeNumber

func (q *Query) WithEpisodeNumber(episode uint16) *Query

func (*Query) WithGenres

func (q *Query) WithGenres(genres ...string) *Query

func (*Query) WithIMDbID

func (q *Query) WithIMDbID(imdbURL string) *Query

func (*Query) WithOthers

func (q *Query) WithOthers(names ...string) *Query

func (*Query) WithSearchItem

func (q *Query) WithSearchItem(searchItem SearchTitlesParams) *Query

func (*Query) WithSeasonNumber

func (q *Query) WithSeasonNumber(season uint16) *Query

func (*Query) WithTMDbID

func (q *Query) WithTMDbID(tmdbID int) *Query

func (*Query) WithTVShowID

func (q *Query) WithTVShowID(tvshowID int) *Query

func (*Query) WithTitles

func (q *Query) WithTitles(fuzzyMatch bool, titles ...string) *Query

func (*Query) WithType

func (q *Query) WithType(itemType string) *Query

func (*Query) WithYearRange

func (q *Query) WithYearRange(year, diff uint16) *Query

type Rating

type Rating struct {
	Source string  `json:"source,omitempty"`
	Value  float32 `json:"value,omitempty"`
}

type SearchEpisodesParams

type SearchEpisodesParams struct {
	IDs     IDs
	Episode uint16
	Season  uint16
}

type SearchTitlesParams

type SearchTitlesParams struct {
	Query     string `json:"query,omitempty"`
	Attribute string `json:"attribute,omitempty"`
	Year      uint16 `json:"year,omitempty"`
	Type      string `json:"type,omitempty"`
	Timestamp string `json:"@timestamp,omitempty"`
}

type SearchableProvider

type SearchableProvider interface {
	Name() string
	Init(estv *ElasticTV) (SearchableProvider, error)
	SearchTitles(SearchTitlesParams) error
	SearchEpisodes(*Title, uint16, uint16) error
}

type Title

type Title struct {
	Alias       []string    `json:"alias,omitempty"`
	Country     []string    `json:"country,omitempty"`
	Credits     Credits     `json:"credits"`
	Description Description `json:"description"`
	Genre       []string    `json:"genre,omitempty"`
	IDs         IDs         `json:"ids"`
	Image       string      `json:"image,omitempty"`
	Language    string      `json:"language,omitempty"`
	Rating      *Rating     `json:"rating,omitempty"`
	Timestamp   string      `json:"@timestamp"`
	Title       string      `json:"title"`
	Type        string      `json:"type"`
	Year        uint16      `json:"year,omitempty"`
	Tagline     string      `json:"tagline,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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