Documentation ¶
Index ¶
- func GetAllPagesFromIndex(facade *Facade, query *torznab.Query) <-chan search.ExternalResultItem
- func ListBuiltInIndexes() ([]string, error)
- func Watch(facade *Facade, initialQuery *torznab.Query, intervalSec int) <-chan search.ExternalResultItem
- type Aggregate
- func (ag *Aggregate) Capabilities() torznab.Capabilities
- func (ag *Aggregate) Check() error
- func (ag *Aggregate) Download(u string) (io.ReadCloser, error)
- func (ag *Aggregate) GetEncoding() string
- func (ag *Aggregate) Info() Info
- func (ag *Aggregate) MaxSearchPages() uint
- func (ag *Aggregate) Open(s *search.ExternalResultItem) (io.ReadCloser, error)
- func (ag *Aggregate) ProcessRequest(req *http.Request) (*http.Response, error)
- func (ag *Aggregate) Search(query *torznab.Query, srch search.Instance) (search.Instance, error)
- func (ag *Aggregate) SearchIsSinglePaged() bool
- type AggregateInfo
- type AssetLoader
- type CachedScope
- type DefinitionDataLoader
- type DefinitionLoader
- type Facade
- func NewAggregateFacadeWithCategories(config config.Config, cats ...categories.Category) *Facade
- func NewEmptyFacade(config config.Config) *Facade
- func NewFacade(indexerName string, config config.Config, cats ...categories.Category) (*Facade, error)
- func NewFacadeFromConfiguration(config config.Config) *Facade
- func (th *Facade) GetDefaultOptions() *GenericSearchOptions
- func (th *Facade) Search(searchContext search.Instance, query *torznab.Query) (search.Instance, error)
- func (th *Facade) SearchKeywords(searchContext search.Instance, query string, page uint) (search.Instance, error)
- func (th *Facade) SearchKeywordsWithCategory(searchContext search.Instance, query string, cat categories.Category, ...) (search.Instance, error)
- type FileIndexLoader
- type GenericSearchOptions
- type Indexer
- type IndexerDefinition
- type IndexerDefinitionStats
- type IndexerInfo
- type IndexerState
- type Info
- type LoginError
- type MultipleDefinitionLoader
- type RunContext
- type Runner
- func (r *Runner) CachePage(browsable browser.Browsable) error
- func (r *Runner) Capabilities() torznab.Capabilities
- func (r *Runner) Check() error
- func (r *Runner) Download(u string) (io.ReadCloser, error)
- func (r *Runner) GetEncoding() string
- func (r *Runner) Info() Info
- func (r *Runner) MaxSearchPages() uint
- func (r *Runner) Open(s *search.ExternalResultItem) (io.ReadCloser, error)
- func (r *Runner) ProcessRequest(req *http.Request) (*http.Response, error)
- func (r *Runner) Ratio() (string, error)
- func (r *Runner) Search(query *torznab.Query, srch search.Instance) (search.Instance, error)
- func (r *Runner) SearchIsSinglePaged() bool
- type RunnerOpts
- type RunnerPatternData
- type Scope
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAllPagesFromIndex ¶ added in v0.2.1
func GetAllPagesFromIndex(facade *Facade, query *torznab.Query) <-chan search.ExternalResultItem
IteratePages goes over all the pages in an index and returns the results through a channel.
func ListBuiltInIndexes ¶ added in v0.2.1
ListBuiltInIndexes returns a list of all the embedded indexes that are supported.
func Watch ¶
func Watch(facade *Facade, initialQuery *torznab.Query, intervalSec int) <-chan search.ExternalResultItem
Watch tracks an index for any new items, through all search pages(or max pages). Whenever old results are found, or we've exhausted the number of pages, the search restarts from the start. The interval is in seconds, it's used to sleep after each search for new results.
Types ¶
type Aggregate ¶
type Aggregate struct {
Indexers []Indexer
}
func NewAggregate ¶
CreateWithId a new aggregate from the given indexers
func (*Aggregate) Capabilities ¶
func (ag *Aggregate) Capabilities() torznab.Capabilities
func (*Aggregate) GetEncoding ¶
func (*Aggregate) MaxSearchPages ¶
MaxSearchPages returns the maximum number of pages that this aggregate can search, this is using the maximum paged index in the aggregate.
func (*Aggregate) Open ¶
func (ag *Aggregate) Open(s *search.ExternalResultItem) (io.ReadCloser, error)
func (*Aggregate) ProcessRequest ¶
func (*Aggregate) SearchIsSinglePaged ¶
SearchIsSinglePaged this is true only if all indexes inside the aggregate are single paged.
type AggregateInfo ¶
type AggregateInfo struct{}
func (*AggregateInfo) GetId ¶
func (a *AggregateInfo) GetId() string
func (*AggregateInfo) GetLanguage ¶
func (a *AggregateInfo) GetLanguage() string
func (*AggregateInfo) GetLink ¶
func (a *AggregateInfo) GetLink() string
func (*AggregateInfo) GetTitle ¶
func (a *AggregateInfo) GetTitle() string
type AssetLoader ¶
type AssetLoader struct { Names []string Resolver DefinitionDataLoader }
func (*AssetLoader) List ¶
func (l *AssetLoader) List() ([]string, error)
List all the names of the embedded definitions
func (*AssetLoader) Load ¶
func (l *AssetLoader) Load(key string) (*IndexerDefinition, error)
Load a definition with a given name
type CachedScope ¶
type CachedScope struct {
// contains filtered or unexported fields
}
func (*CachedScope) CreateAggregate ¶
func (c *CachedScope) CreateAggregate(config config.Config) (Indexer, error)
CreateAggregate gets you an aggregate of all the valid configured indexers this includes indexers that don't need a login.
func (*CachedScope) CreateAggregateForCategories ¶
func (c *CachedScope) CreateAggregateForCategories(config config.Config, cats []categories.Category) (Indexer, error)
CreateAggregateForCategories creates a new aggregate with the indexers that match a set of categories
type DefinitionDataLoader ¶
An indexer definition loader that uses embedded definitions.
type DefinitionLoader ¶
type DefinitionLoader interface { //List - Lists available trackers. List() ([]string, error) //Load - Load a definition of an Indexer from it's name Load(key string) (*IndexerDefinition, error) }
DefinitionLoader loads an index definition by name or lists the names of the supported indexes.
var ( ErrUnknownIndexer = errors.New("unknown indexer") DefaultDefinitionLoader DefinitionLoader Loader DefinitionLoader )
func CreateEmbeddedDefinitionSource ¶
func CreateEmbeddedDefinitionSource(definitionNames []string, loader DefinitionDataLoader) DefinitionLoader
CreateEmbeddedDefinitionSource creates a new definition loader from a set of resource names and a loader.
type Facade ¶
type Facade struct { //The indexer that we're using Indexer Indexer //Configuration for the indexer. Config config.Config Scope Scope }
Facade for an indexer/aggregate, helps manage the scope of the index, it's configuration and the index itself.
func NewAggregateFacadeWithCategories ¶ added in v0.2.1
func NewAggregateFacadeWithCategories(config config.Config, cats ...categories.Category) *Facade
NewAggregateFacadeWithCategories Finds an indexer from the config, that matches the given categories.
func NewEmptyFacade ¶
NewEmptyFacade creates a new indexer facade with it's own scope and config.
func NewFacade ¶
func NewFacade(indexerName string, config config.Config, cats ...categories.Category) (*Facade, error)
NewFacade Creates a new facade for an indexer with the given name and config. If any categories are given, the facade must be for an indexer that supports these categories. If you don't provide a name or name is `all`, an aggregate is used.
func NewFacadeFromConfiguration ¶
NewFacadeFromConfiguration Creates a new facade using the configuration
func (*Facade) GetDefaultOptions ¶
func (th *Facade) GetDefaultOptions() *GenericSearchOptions
GetDefaultOptions gets the default search options
func (*Facade) Search ¶
func (th *Facade) Search(searchContext search.Instance, query *torznab.Query) (search.Instance, error)
Search using a given query. The search covers only 1 page.
type FileIndexLoader ¶
type FileIndexLoader struct {
Directories []string
}
func NewFsLoader ¶
func NewFsLoader(appName string) *FileIndexLoader
NewFsLoader creates a new file index loader which looks for definitions in ~/.#{appName}/indexes and ./indexes
func (*FileIndexLoader) List ¶
func (fs *FileIndexLoader) List() ([]string, error)
func (*FileIndexLoader) Load ¶
func (fs *FileIndexLoader) Load(key string) (*IndexerDefinition, error)
Load - Load a definition of an Indexer from it's name
func (*FileIndexLoader) String ¶
func (fs *FileIndexLoader) String() string
type GenericSearchOptions ¶
type GenericSearchOptions struct { //The count of pages we can fetch PageCount uint //The initial search page StartingPage uint MaxRequestsPerSecond uint StopOnStaleResults bool }
GenericSearchOptions options for the search.
type Indexer ¶
type Indexer interface { Info() Info Search(query *torznab.Query, srch search.Instance) (search.Instance, error) Download(urlStr string) (io.ReadCloser, error) Capabilities() torznab.Capabilities GetEncoding() string ProcessRequest(req *http.Request) (*http.Response, error) Open(s *search.ExternalResultItem) (io.ReadCloser, error) //Check if the Indexer works ok. //This might be needed to validate the search result extraction. Check() error //The maximum number of pages we can search MaxSearchPages() uint SearchIsSinglePaged() bool }
type IndexerDefinition ¶
type IndexerDefinition struct { Site string `yaml:"site"` Settings []settingsField `yaml:"settings"` Name string `yaml:"name"` Description string `yaml:"description"` Language string `yaml:"language"` Links stringorslice `yaml:"links"` Capabilities capabilitiesBlock `yaml:"caps"` Login loginBlock `yaml:"login"` Ratio ratioBlock `yaml:"ratio"` Search searchBlock `yaml:"search"` Encoding string `yaml:"encoding"` //Entities that the index contains Entities []entityBlock `yaml:"entities"` //The ms to wait between each request. RateLimit int `yaml:"ratelimit"` // contains filtered or unexported fields }
func LoadEnabledDefinitions ¶
func LoadEnabledDefinitions(conf interface{}) ([]*IndexerDefinition, error)
LoadEnabledDefinitions loads all of the definitions that are covered by the current definition loader (`Loader`).
func ParseDefinition ¶
func ParseDefinition(src []byte) (*IndexerDefinition, error)
func ParseDefinitionFile ¶
func ParseDefinitionFile(f *os.File) (*IndexerDefinition, error)
ParseDefinitionFile loads an Indexer's definition from a file
func (*IndexerDefinition) Stats ¶
func (id *IndexerDefinition) Stats() IndexerDefinitionStats
type IndexerDefinitionStats ¶
type IndexerInfo ¶
func (IndexerInfo) GetId ¶
func (i IndexerInfo) GetId() string
func (IndexerInfo) GetLanguage ¶
func (i IndexerInfo) GetLanguage() string
func (IndexerInfo) GetLink ¶
func (i IndexerInfo) GetLink() string
func (IndexerInfo) GetTitle ¶
func (i IndexerInfo) GetTitle() string
type IndexerState ¶
type IndexerState struct {
// contains filtered or unexported fields
}
func (*IndexerState) GetBool ¶
func (is *IndexerState) GetBool(key string) bool
func (*IndexerState) Has ¶
func (is *IndexerState) Has(key string) bool
func (*IndexerState) Set ¶
func (is *IndexerState) Set(key string, val interface{})
type LoginError ¶
type LoginError struct {
// contains filtered or unexported fields
}
func (*LoginError) Error ¶
func (e *LoginError) Error() string
type MultipleDefinitionLoader ¶
type MultipleDefinitionLoader []DefinitionLoader
func (MultipleDefinitionLoader) List ¶
func (ml MultipleDefinitionLoader) List() ([]string, error)
func (MultipleDefinitionLoader) Load ¶
func (ml MultipleDefinitionLoader) Load(key string) (*IndexerDefinition, error)
Load an indexer with the matching name
type RunContext ¶
type Runner ¶
type Runner struct { Storage storage.ItemStorage // contains filtered or unexported fields }
Runner works index definitions in order to extract data.
func NewRunner ¶
func NewRunner(def *IndexerDefinition, opts RunnerOpts) *Runner
NewRunner Start a runner for a given indexer.
func (*Runner) CachePage ¶ added in v0.2.2
If caching is enabled, we cache the page's contents in our pagecache the current browser page is cached
func (*Runner) Capabilities ¶
func (r *Runner) Capabilities() torznab.Capabilities
Capabilities gets the torznab formatted capabilities of this Indexer.
func (*Runner) GetEncoding ¶
GetEncoding returns the encoding that's set to be used in this index. This can be changed in the index's definition.
func (*Runner) MaxSearchPages ¶
func (*Runner) Open ¶
func (r *Runner) Open(s *search.ExternalResultItem) (io.ReadCloser, error)
func (*Runner) ProcessRequest ¶
func (*Runner) SearchIsSinglePaged ¶
type RunnerOpts ¶
type RunnerOpts struct { Config config.Config CachePages bool Transport http.RoundTripper }
type RunnerPatternData ¶
type RunnerPatternData struct { Query *torznab.Query Keywords string Categories []string Context RunContext }
Source Files ¶
- aggregate.go
- assetLoader.go
- browsing.go
- categoryMap.go
- categoryResolving.go
- context.go
- creation.go
- download.go
- entities.go
- errors.go
- escLoader.go
- facade.go
- filters.go
- fsLoader.go
- indexContentCache.go
- indexer.go
- info.go
- load.go
- login.go
- multipleDefsLoader.go
- parser.go
- resultExtraction.go
- runner.go
- searchDefinition.go
- selection.go
- state.go
- templating.go
- utils.go
- watch.go
Directories ¶
Path | Synopsis |
---|---|
mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |