search

package
v0.3.11 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2020 License: GPL-3.0 Imports: 8 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetResultFingerprint

func GetResultFingerprint(t *ExternalResultItem) string

Types

type AggregatedSearch

type AggregatedSearch struct {
	SearchContexts map[interface{}]Instance
	// contains filtered or unexported fields
}

func NewAggregatedSearch

func NewAggregatedSearch() *AggregatedSearch

func (*AggregatedSearch) GetResults

func (a *AggregatedSearch) GetResults() []ExternalResultItem

func (*AggregatedSearch) GetStartingIndex

func (a *AggregatedSearch) GetStartingIndex() int

func (*AggregatedSearch) SetId

func (s *AggregatedSearch) SetId(val string)

func (*AggregatedSearch) SetResults

func (a *AggregatedSearch) SetResults(results []ExternalResultItem)

func (*AggregatedSearch) SetStartIndex

func (a *AggregatedSearch) SetStartIndex(key interface{}, i int)

type CanBeStale added in v0.3.0

type CanBeStale interface {
	SetState(new, updated bool)
}

type Equatable added in v0.3.0

type Equatable interface {
	Equals(other interface{}) bool
}

type ExternalResultItem

type ExternalResultItem struct {
	Model
	ResultItem
	LocalCategoryID   string
	LocalCategoryName string
	LocalId           string
	Announce          string
	Publisher         string

	PublishedWith string
	// contains filtered or unexported fields
}

func (*ExternalResultItem) Equals

func (i *ExternalResultItem) Equals(other interface{}) bool

Equals checks if this item matches the other one exactly(excluding the ID) TODO: refactor this to reduce #complexity

func (*ExternalResultItem) GetField

func (i *ExternalResultItem) GetField(key string) interface{}

GetField by a key, use this for extra fields.

func (*ExternalResultItem) Id added in v0.3.0

func (i *ExternalResultItem) Id() uint32

func (*ExternalResultItem) IsNew

func (i *ExternalResultItem) IsNew() bool

IsNew whether the result is new to us.

func (*ExternalResultItem) IsUpdate

func (i *ExternalResultItem) IsUpdate() bool

IsUpdate whether the result is an update to an existing one.

func (*ExternalResultItem) SetField

func (i *ExternalResultItem) SetField(key string, val interface{})

SetField sets the value of an extra fields

func (*ExternalResultItem) SetId added in v0.3.0

func (i *ExternalResultItem) SetId(id uint32)

func (*ExternalResultItem) SetState

func (i *ExternalResultItem) SetState(isNew bool, update bool)

SetState sets the staleness state of this result.

func (*ExternalResultItem) SetUUID added in v0.3.0

func (i *ExternalResultItem) SetUUID(u string)

func (*ExternalResultItem) UUID added in v0.3.0

func (i *ExternalResultItem) UUID() string

type IDed added in v0.3.0

type IDed interface {
	Id() uint32
	SetId(uint32)
}

type Instance

type Instance interface {
	GetStartingIndex() int
	GetResults() []ExternalResultItem
	SetStartIndex(key interface{}, i int)
	SetResults(extracted []ExternalResultItem)
	SetId(val string)
}

An instance of a search

type Model added in v0.2.2

type Model struct {
	ID        uint32 `gorm:"primary_key"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time `sql:"index"`
}

type PaginationSearch

type PaginationSearch struct {
	PageCount    uint
	StartingPage uint
}

type Record added in v0.3.0

type Record interface {
	UUIDed
	IDed
	CanBeStale
}

type ResultIndexer

type ResultIndexer struct {
	Id   string `xml:"id,attr"`
	Name string `xml:",chardata"` //make the name the value
}

type ResultItem

type ResultItem struct {
	Site          string
	Title         string
	OriginalTitle string
	ShortTitle    string
	Description   string
	UUIDValue     string
	Comments      string
	Link          string
	Fingerprint   string
	Banner        string
	IsMagnet      bool

	SourceLink  string
	MagnetLink  string
	Category    int
	Size        uint32
	Files       int
	Grabs       int
	PublishDate int64

	Seeders              int
	Peers                int
	MinimumRatio         float64
	MinimumSeedTime      time.Duration
	DownloadVolumeFactor float64
	UploadVolumeFactor   float64
	Author               string
	AuthorId             string
	Indexer              *ResultIndexer
	ExtraFields          map[string]interface{} `gorm:"-"` // Ignored in gorm
}

func (*ResultItem) AddedOnStr

func (ri *ResultItem) AddedOnStr() string

AddedOnStr gets the publish date of this result as a string

func (ResultItem) MarshalXML

func (ri ResultItem) MarshalXML(e *xml.Encoder, _ xml.StartElement) error

type RunOptions

type RunOptions struct {
	MaxRequestsPerSecond uint
	StopOnStaleTorrents  bool
}
type Search struct {
	DOM *goquery.Selection
	Id  string

	StartIndex int
	Results    []ExternalResultItem
	// contains filtered or unexported fields
}

func (*Search) GetDocument

func (s *Search) GetDocument() *goquery.Selection

func (*Search) GetResults

func (s *Search) GetResults() []ExternalResultItem

func (*Search) GetStartingIndex

func (s *Search) GetStartingIndex() int

func (*Search) SetId

func (s *Search) SetId(val string)

func (*Search) SetResults

func (s *Search) SetResults(results []ExternalResultItem)

func (*Search) SetStartIndex

func (s *Search) SetStartIndex(key interface{}, i int)

type SearchMode

type SearchMode struct {
	Key             string
	Available       bool
	SupportedParams []string
}

type UUIDed added in v0.3.0

type UUIDed interface {
	UUID() string
	SetUUID(string)
}

Jump to

Keyboard shortcuts

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