Documentation ¶
Index ¶
- func AbsInt(a int) int
- func IsExistsErr(err error) bool
- func IsMediaError(err error) bool
- func IsSample(m types.Media) bool
- func IsUnknown(err error) bool
- func NewExistsErr() error
- func NewFromFilename(name string) (types.Media, error)
- func NewFromString(str string) (types.Media, error)
- func NewLocalFile(path string) (types.LocalMedia, error)
- func NewLocalSubtitle(path string) (types.LocalSubtitle, error)
- func NewUnknownErr() error
- type Episode
- func (e *Episode) Episode() int
- func (e *Episode) EpisodeName() string
- func (e *Episode) Identity() string
- func (e *Episode) IsVideo() bool
- func (e *Episode) MarshalJSON() (b []byte, err error)
- func (e *Episode) Merge(other types.Media) error
- func (e *Episode) Meta() types.Metadata
- func (e *Episode) Season() int
- func (e *Episode) Similar(other types.Media) bool
- func (e *Episode) String() string
- func (e *Episode) TVShow() string
- func (e *Episode) TypeEpisode() (types.Episode, bool)
- type ErrExists
- type ErrUnknown
- type Error
- type File
- type FilePath
- type LocalSubtitle
- type Metadata
- func (m Metadata) AllTags() []string
- func (m Metadata) Codec() codec.Tag
- func (m Metadata) Group() string
- func (m Metadata) MarshalJSON() (b []byte, err error)
- func (m Metadata) Misc() misc.List
- func (m Metadata) Quality() quality.Tag
- func (m Metadata) Source() source.Tag
- func (m Metadata) String() string
- type Movie
- func (m *Movie) Identity() string
- func (m *Movie) IsVideo() bool
- func (m *Movie) MarshalJSON() (b []byte, err error)
- func (m *Movie) Merge(other types.Media) error
- func (m *Movie) Meta() types.Metadata
- func (m *Movie) MovieName() string
- func (m *Movie) Similar(other types.Media) bool
- func (m *Movie) String() string
- func (m *Movie) TypeMovie() (types.Movie, bool)
- func (m *Movie) Year() int
- type Subtitlable
- type Subtitle
- func (l *Subtitle) ForMedia() types.Media
- func (l *Subtitle) HearingImpaired() bool
- func (l *Subtitle) Identity() string
- func (l *Subtitle) Language() language.Tag
- func (l *Subtitle) Merge(other types.Media) error
- func (l *Subtitle) Meta() types.Metadata
- func (l *Subtitle) Similar(other types.Media) bool
- func (l *Subtitle) String() string
- func (l *Subtitle) TypeSubtitle() (types.Subtitle, bool)
- type TypeNone
- type Video
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsExistsErr ¶ added in v1.0.0
IsExistsErr returns true if the error is of type *ErrExists
func IsMediaError ¶ added in v1.0.0
IsMediaError returns true if the error is of type *media.Error
func IsSample ¶
IsSample return wether the media is a sample video of the real media. The media is a sample if any of the tags contains "sample" (case insensitive)
func NewExistsErr ¶ added in v1.0.0
func NewExistsErr() error
NewExistsErr return a new error indicating a conflict with existing media
func NewFromFilename ¶ added in v1.0.0
NewFromFilename parses the filename and returns a media object. The filename (with extenstion) may describe either some video material (.avi, .mkv, .mp4) or a subtitle (.srt).
func NewFromString ¶ added in v1.0.0
NewFromString returns a media object parsed from a string describing the media. This could be the name of a file (without extension). It is assumed the string describes some video material (movie or episode)
func NewLocalFile ¶ added in v1.0.0
func NewLocalFile(path string) (types.LocalMedia, error)
NewLocalFile parses a filepath into a local media object. The path may be an absolute or relative path. The filename of the media must contain appropriate information to describe the media file.
func NewLocalSubtitle ¶
func NewLocalSubtitle(path string) (types.LocalSubtitle, error)
NewLocalSubtitle returns a new local subtitle
func NewUnknownErr ¶ added in v1.0.0
func NewUnknownErr() error
NewUnknownErr returns a new error indicating unknown media
Types ¶
type Episode ¶ added in v1.0.0
Episode represents an episode from a TV show
func NewEpisode ¶
NewEpisode parses media info from a filename (without extension). The filename must describe the episode adequately (e.g. must contain season and episode numbers)
func (*Episode) EpisodeName ¶ added in v1.0.0
EpisodeName is the name of the episode
func (*Episode) Identity ¶ added in v1.0.0
Identity returns the identity string of the episode which can be used for hashing, caching ect.
func (*Episode) MarshalJSON ¶ added in v1.0.0
MarshalJSON returns the JSON representation of an episode
func (*Episode) Similar ¶ added in v1.0.0
Similar returns true if other media is also an episode from the same season and with the same episode number
type ErrExists ¶ added in v1.0.0
type ErrExists struct{}
ErrExists is an error for when media already exists in a library
type ErrUnknown ¶ added in v1.0.0
type ErrUnknown struct{}
ErrUnknown is an error for unrecognized media
func (*ErrUnknown) Error ¶ added in v1.0.0
func (e *ErrUnknown) Error() string
type Error ¶ added in v1.0.0
type Error struct {
// contains filtered or unexported fields
}
Error is an error concerning some media
type File ¶
File represents a local media file on disk
func (*File) MarshalJSON ¶
MarshalJSON returns the JSON represnetation of a media file
type FilePath ¶ added in v0.2.0
type FilePath string
FilePath is a string describing a path to a file
type LocalSubtitle ¶
LocalSubtitle represents a subtitle stored on disk
func (*LocalSubtitle) MarshalJSON ¶
func (l *LocalSubtitle) MarshalJSON() (b []byte, err error)
MarshalJSON returns a JSON representation of the subtitle
type Metadata ¶
type Metadata struct {
// contains filtered or unexported fields
}
Metadata provides release information for media
func ParseMetadata ¶
ParseMetadata generates metadata from a string
func ParseMetadataIndex ¶ added in v1.0.0
ParseMetadataIndex generates metadata from a string and returns the index of the first occurrence of metdata information in the string
func (Metadata) MarshalJSON ¶
MarshalJSON returns a JSON representation of metadata
type Movie ¶ added in v1.0.0
type Movie struct { Metadata TypeNone NameX string YearX int // contains filtered or unexported fields }
Movie represents a movie file
func NewMovie ¶
NewMovie parses media info from a filename (without extension). The filename must describe the movie adequately (e.g. must contain the release year)
func (*Movie) Identity ¶ added in v1.0.0
Identity returns an identity string for the movie which can be used for hashing, caching ect.
func (*Movie) MarshalJSON ¶ added in v1.0.0
MarshalJSON return the JSON representation of a movie
func (*Movie) Similar ¶ added in v1.0.0
Similar returns true if two movies are within 1 year of each other
type Subtitlable ¶ added in v1.0.0
type Subtitlable interface {
IsVideo() bool
}
Subtitlable is an dummy interface for media which supports subtitles
type Subtitle ¶ added in v1.0.0
type Subtitle struct { TypeNone // contains filtered or unexported fields }
Subtitle represents the information about a subtitle
func NewSubtitle ¶ added in v1.0.0
NewSubtitle returns subtitle information by parsing the string. The string should describe some video material sufficiently (without extension). If the string ends with a language tag (e.g. .en .es. de) then the language will be parsed
func (*Subtitle) ForMedia ¶ added in v1.0.0
ForMedia returns the media the subtitle is matched against
func (*Subtitle) HearingImpaired ¶ added in v1.0.0
HearingImpaired returns false since this information in unparseable from a simple filename
func (*Subtitle) Identity ¶ added in v1.0.0
Identity returns the identity string for the media which the subtitle matches
func (*Subtitle) Meta ¶ added in v1.0.0
Meta returns the metadata for media which the subtitle belongs
func (*Subtitle) Similar ¶ added in v1.0.0
Similar returns true if other media is also a subtitle for the a similar media
type TypeNone ¶ added in v1.0.0
type TypeNone struct{}
TypeNone represents a media of unknown format. Can be used for embedding into other types to fill common mundane methods
func (TypeNone) TypeEpisode ¶ added in v1.0.0
TypeEpisode return false, since TypeNone is of an unknown media type
type Video ¶ added in v1.0.0
type Video struct {
*File
}
Video represents special media which has subtitles
func (*Video) ExistingSubtitles ¶ added in v1.0.0
func (f *Video) ExistingSubtitles() (types.SubtitleList, error)
ExistingSubtitles returns a list of existing subtitles for the media
func (*Video) SaveSubtitle ¶ added in v1.0.0
SaveSubtitle saves the subtitle for the given media to disk