meta

package
v0.0.0-...-0805d90 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BasicCastMember

type BasicCastMember struct {
	Name_  string      `json:"name"`
	Role_  string      `json:"role"`
	Image_ *BasicImage `json:"image"`
}

BasicCastMember is a JSON-serializable CastMember.

func NewBasicCastMember

func NewBasicCastMember(cm CastMember) *BasicCastMember

NewBasicCastMember wraps a CastMember into BasicCastMember.

func (*BasicCastMember) Image

func (bcm *BasicCastMember) Image() Image

func (*BasicCastMember) Name

func (bcm *BasicCastMember) Name() string

func (*BasicCastMember) Role

func (bcm *BasicCastMember) Role() string

type BasicEpisodeMetadata

type BasicEpisodeMetadata struct {
	*BasicMetadata

	Series_  *BasicMovieOrSeriesMetadata `json:"series"`
	Season_  int                         `json:"season"`
	Episode_ int                         `json:"episode"`
}

BasicEpisodeMetadata is an EpisodeMetadata implementation with defined values.

func NewBasicEpisodeMetadata

func NewBasicEpisodeMetadata(em EpisodeMetadata) *BasicEpisodeMetadata

NewBasicEpisodeMetadata wraps a EpisodeMetadata object into BasicEpisodeMetadata.

func (*BasicEpisodeMetadata) Episode

func (bem *BasicEpisodeMetadata) Episode() int

func (*BasicEpisodeMetadata) Season

func (bem *BasicEpisodeMetadata) Season() int

func (*BasicEpisodeMetadata) Series

type BasicImage

type BasicImage struct {
	Type_        ImageType `json:"type"`
	Path_        string    `json:"path"`
	Remote_      bool      `json:"remote"`
	Description_ string    `json:"description"`
}

BasicImage is a JSON-serializable Image.

func NewBasicImage

func NewBasicImage(i Image) *BasicImage

NewBasicImage wraps an Image into BasicImage.

func (*BasicImage) Description

func (bi *BasicImage) Description() string

func (*BasicImage) Path

func (bi *BasicImage) Path() string

func (*BasicImage) Remote

func (bi *BasicImage) Remote() bool

func (*BasicImage) Type

func (bi *BasicImage) Type() ImageType

type BasicMetadata

type BasicMetadata struct {
	Type_          Type          `json:"type"`
	Title_         string        `json:"title"`
	OriginalTitle_ string        `json:"original_title"`
	Overview_      string        `json:"overview"`
	ReleaseDate_   time.Time     `json:"release_date"`
	VoteRating_    float32       `json:"vote_rating"`
	Images_        []*BasicImage `json:"images"`
}

BasicMetadata is a JSON-serializable Metadata with set values.

func NewBasicMetadata

func NewBasicMetadata(m Metadata) *BasicMetadata

NewBasicMetadata wraps a Metadata object into BasicMetadata.

func (*BasicMetadata) Images

func (bm *BasicMetadata) Images() []Image

func (*BasicMetadata) OriginalTitle

func (bm *BasicMetadata) OriginalTitle() string

func (*BasicMetadata) Overview

func (bm *BasicMetadata) Overview() string

func (*BasicMetadata) ReleaseDate

func (bm *BasicMetadata) ReleaseDate() time.Time

func (*BasicMetadata) Title

func (bm *BasicMetadata) Title() string

func (*BasicMetadata) Type

func (bm *BasicMetadata) Type() Type

func (*BasicMetadata) VoteRating

func (bm *BasicMetadata) VoteRating() float32

type BasicMovieOrSeriesMetadata

type BasicMovieOrSeriesMetadata struct {
	*BasicMetadata

	Genres_    []string           `json:"genres"`
	Cast_      []*BasicCastMember `json:"cast"`
	Languages_ []string           `json:"languages"`
	Countries_ []string           `json:"countries"`
}

BasicMovieOrSeriesMetadata is a JSON-serializable MovieOrSeriesMetadata.

func NewBasicMovieOrSeriesMetadata

func NewBasicMovieOrSeriesMetadata(msm MovieOrSeriesMetadata) *BasicMovieOrSeriesMetadata

NewBasicMovieOrSeriesMetadata wraps a MovieOrSeriesMetadata into BasicMovieOrSeriesMetadata.

func (*BasicMovieOrSeriesMetadata) Cast

func (bmsm *BasicMovieOrSeriesMetadata) Cast() []CastMember

func (*BasicMovieOrSeriesMetadata) Countries

func (bmsm *BasicMovieOrSeriesMetadata) Countries() []language.Region

func (*BasicMovieOrSeriesMetadata) Genres

func (bmsm *BasicMovieOrSeriesMetadata) Genres() []string

func (*BasicMovieOrSeriesMetadata) Languages

func (bmsm *BasicMovieOrSeriesMetadata) Languages() []language.Tag

type CastMember

type CastMember interface {
	// Name returns the real name of the cast member.
	Name() string
	// Role returns the name of the cast character.
	Role() string
	// Image returns the image of the cast member.
	Image() Image
}

CastMember is a metadata object of a cast member.

func NewCastMember

func NewCastMember(name, role string, image Image) CastMember

NewCastMember creates a CastMember with set values.

type EpisodeMetadata

type EpisodeMetadata interface {
	Metadata

	// Series returns the underlying series' metadata.
	Series() MovieOrSeriesMetadata
	// Season returns the season number, such as 1.
	Season() int
	// Episode returns the episode number, such as 1.
	Episode() int
}

EpisodeMetadata is a metadata object of a series' episode.

func NewEpisodeMetadata

func NewEpisodeMetadata(m Metadata, series MovieOrSeriesMetadata, season, episode int) EpisodeMetadata

NewEpisodeMetadata creates an EpisodeMetadata with set values.

type ErrInvalidQuery

type ErrInvalidQuery struct {
	// Query is the string query.
	Query string
	// Type is the targeted metadata type.
	Type Type
}

ErrInvalidQuery is an error about an invalid metadata query, most likely missing/unexpected data.

func (*ErrInvalidQuery) Error

func (eiq *ErrInvalidQuery) Error() string

Error returns the string representation of the error.

type Image

type Image interface {
	// Type returns the image's type.
	Type() ImageType
	// Path returns the image's path.
	Path() string
	// Remote returns whether Path returns a remote URL.
	Remote() bool
	// Description returns the image's description.
	Description() string
}

Image is an image file.

func NewImage

func NewImage(type_ ImageType, path string, remote bool, description string) Image

NewImage creates an Image with set values.

type ImageType

type ImageType uint

ImageType is a type of image.

const (
	// ImageTypeUnknown is an unspecified image type.
	ImageTypeUnknown ImageType = iota
	// ImageTypeStill is a still image type (https://en.wikipedia.org/wiki/Film_still).
	ImageTypeStill
	// ImageTypeBackdrop is a background image type.
	ImageTypeBackdrop
	// ImageTypePoster is a poster image type.
	ImageTypePoster
	// ImageTypeAvatar is a person avatar image type.
	ImageTypeAvatar
)

type Metadata

type Metadata interface {
	// Type returns the type of metadata.
	Type() Type
	// Title returns the title, such as "Bocchi the Rock!".
	Title() string
	// OriginalTitle returns the title as in the original release, such as "ぼっち・ざ・ろっく!".
	OriginalTitle() string
	// Overview returns the plot overview, such as "Hitori Gotoh, a shy, awkward, and lonely high school student dreams of being in a band despite her doubts and worries, but when she is recruited to be the guitarist of a group looking to make it big, she realises her dream may be able to be fulfilled and come true.".
	Overview() string
	// ReleaseDate returns the date of release, such as "2022-10-09".
	ReleaseDate() time.Time
	// VoteRating returns the average rating of the media, between 0 and 10, such as 8.7.
	VoteRating() float32
	// Images returns the promotional images of the media.
	Images() []Image
}

Metadata is a media metadata object.

func NewMetadata

func NewMetadata(type_ Type, title, originalTitle, overview string, releaseDate time.Time, voteRating float32, images []Image) Metadata

NewMetadata creates a Metadata with set values.

type MovieOrSeriesMetadata

type MovieOrSeriesMetadata interface {
	Metadata

	// Genres returns the genre names.
	Genres() []string
	// Cast returns the cast members.
	Cast() []CastMember
	// Languages returns tags of the languages spoken in the movie or series.
	Languages() []language.Tag
	// Countries returns tags of the regions that took part in producing the movie or series.
	Countries() []language.Region
}

MovieOrSeriesMetadata is a metadata object of a movie or series.

func NewMovieOrSeriesMetadata

func NewMovieOrSeriesMetadata(
	m Metadata,
	genres []string,
	castMembers []CastMember,
	languages []language.Tag,
	countries []language.Region,
) MovieOrSeriesMetadata

NewMovieOrSeriesMetadata creates a MovieOrSeriesMetadata with set values.

type Query

type Query struct {
	// Query is the string used for searching the movie or series.
	Query string `json:"query"`
	// Type is the type of metadata to search for, 0 (TypeUnknown) searches for all media.
	Type Type `json:"type"`
	// Season is the season number, 0 means don't search for a specific episode.
	Season int `json:"season"`
	// Episode is the episode number in the season, 0 means don't search for a specific episode.
	Episode int `json:"episode"`
}

Query is a search query for a movie or a series episode.

type Source

type Source interface {
	// FromFile tries to resolve metadata for a media file, may return nil.
	FromFile(path string) (Metadata, error)
	// FromQuery tries to resolve metadata for a custom query, may return nil.
	FromQuery(query *Query) (Metadata, error)
}

Source is a source of Metadata.

func NewCompositeSource

func NewCompositeSource(metaSources ...Source) Source

NewCompositeSource creates a metadata source that resolves results from multiple sources.

func NewDummySource

func NewDummySource() Source

NewDummySource creates a Source that discovers nothing.

func NewFileAnalysisSource

func NewFileAnalysisSource(metaSource Source) Source

NewFileAnalysisSource creates a metadata source that analyzes files, creates a query and delegates the query resolving to metaSource.

func NewLiteralSource

func NewLiteralSource() Source

NewLiteralSource creates a Source that creates rough metadata from queries.

type Type

type Type uint

Type is a type of metadata.

const (
	// TypeUnknown is an unknown media metadata type.
	TypeUnknown Type = iota
	// TypeMovie is a movie metadata type.
	TypeMovie
	// TypeSeries is a series metadata type.
	TypeSeries
	// TypeEpisode is a series episode metadata type.
	TypeEpisode
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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