Documentation
¶
Overview ¶
Package providers contains functions to interact with different subtitle providers.
Package providers contains functions to interact with different subtitle providers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNextProvider = errors.New("user requested next provider")
Functions ¶
This section is empty.
Types ¶
type ErrNoResultsFound ¶ added in v0.1.15
func (ErrNoResultsFound) Error ¶ added in v0.1.15
func (e ErrNoResultsFound) Error() string
type Provider ¶ added in v0.1.5
type Provider interface {
// Name returns the provider's display name.
Name() string
// SearchSubtitle searches for subtitles matching the supplied options and returns the matching subtitles.
SearchSubtitle(ctx context.Context, opts SearchOptions) ([]Subtitle, error)
// SelectBest selects the best subtitle from the given search results according to the provider's selection criteria.
SelectBest([]Subtitle) Subtitle
// Download downloads the given subtitle and returns its contents.
Download(ctx context.Context, subtitle Subtitle) (SubtitleFile, error)
// SubtitleHeaders returns the column headers used to display subtitle search results in a table. The first column should be a unique subtitle identifier
SubtitleHeaders() []string
}
Provider searches for and downloads subtitles from a subtitle service.
type ProviderSet ¶ added in v0.1.5
type ProviderSet struct {
// contains filtered or unexported fields
}
ProviderSet coordinates searches and downloads across one or more subtitle providers.
func NewProviderSet ¶ added in v0.1.5
func NewProviderSet() *ProviderSet
NewProviderSet creates a new ProviderSet
func (*ProviderSet) Append ¶ added in v0.1.8
func (set *ProviderSet) Append(provider ...Provider) *ProviderSet
Append adds one or more providers to the ProviderSet and returns the updated set.
func (*ProviderSet) AppendQuery ¶ added in v0.1.10
func (set *ProviderSet) AppendQuery(query ...SearchOptions) *ProviderSet
AppendQuery adds one or more subtitle search queries to the ProviderSet and returns the updated set.
func (*ProviderSet) StartSearchAndDownload ¶ added in v0.1.5
func (set *ProviderSet) StartSearchAndDownload() error
StartSearchAndDownload starts the search and download process for all subtitle queries in the ProviderSet. It iterates through each query and attempts to find and download subtitles from the registered providers. If a provider returns an error, it will continue to the next provider.
type SearchOptions ¶ added in v0.1.11
type SearchOptions struct {
// Search Options
Query string
IMDBId int
Season int
Episode int
Language string
Type string
Year int
IsMovie bool
IsSerie bool
// Download Options
SubtitleFormat subformat.FormatType
OutputFile string
OutputDir string
AutoSelect bool
}
SearchOptions are the general options for searching and downloading subtitles.
type Subtitle ¶
type Subtitle interface {
// ID returns the unique identifier of the subtitle.
ID() string
// Fields returns the values for this subtitle, in the same order as the headers returned by Provider.SubtitleHeaders().
Fields() []string
}
Subtitle represents a provider-specific subtitle search result.
type SubtitleFile ¶ added in v0.1.10
type SubtitleFile struct {
// Name is the suggested filename of the subtitle. Can be empty
Name string
// Type identifies the subtitle format.
Type subformat.FormatType
// ReadCloser provides access to the subtitle contents.
io.ReadCloser
}
SubtitleFile represents the contents of a downloaded subtitle.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package addic7ed is used to interface with the addic7ed subtitle provider using a wrapper.
|
Package addic7ed is used to interface with the addic7ed subtitle provider using a wrapper. |
|
Package opensubtitles is used to talk to opensubtitles API via a wrapper.
|
Package opensubtitles is used to talk to opensubtitles API via a wrapper. |
|
Package opensubtitlesorg is used to get subtitles from opensubtitles.org
|
Package opensubtitlesorg is used to get subtitles from opensubtitles.org |
|
Package subdl is used to search for subtitles from subdl.com
|
Package subdl is used to search for subtitles from subdl.com |
|
Package subdlapi used to search for subtitles from subdl.com using the official subdl api.
|
Package subdlapi used to search for subtitles from subdl.com using the official subdl api. |