Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BaseProvider ¶
type BaseProvider struct { ProviderName string Client *http.Client PollInterval time.Duration // contains filtered or unexported fields }
BaseProvider is the struct used for shared functionality of all providers.
func NewBaseProvider ¶
func NewBaseProvider(name string) *BaseProvider
func (*BaseProvider) GetURL ¶
func (b *BaseProvider) GetURL(u string) (string, []byte, error)
GetURL is designed to be used to download a file from a URL
func (*BaseProvider) Name ¶
func (b *BaseProvider) Name() string
type NZBProvider ¶
type NZBProvider struct {
*BaseProvider
}
func (*NZBProvider) Type ¶
func (t *NZBProvider) Type() ProviderType
type NyaaTorrents ¶
type NyaaTorrents struct { URL string TorrentProvider }
func NewNyaaTorrents ¶
func NewNyaaTorrents(options ...func(*NyaaTorrents)) *NyaaTorrents
NewNyaaTorrents creates a new nzbs.org client
func (*NyaaTorrents) GetNewItems ¶
func (n *NyaaTorrents) GetNewItems() ([]ProviderResult, error)
GetNewItems scans the RSS feed for all new items.
func (*NyaaTorrents) TvSearch ¶
func (n *NyaaTorrents) TvSearch(showName string, season, ep int64) ([]ProviderResult, error)
TvSearch searchs for a particular show
type NzbsOrg ¶
type NzbsOrg struct { URL string APIKEY string NZBProvider }
NzbsOrg provides a client for the nzbs.org provider
func NewNzbsOrg ¶
NewNzbsOrg creates a new nzbs.org client
func (*NzbsOrg) GetNewItems ¶
func (n *NzbsOrg) GetNewItems() ([]ProviderResult, error)
func (*NzbsOrg) TvSearch ¶
func (n *NzbsOrg) TvSearch(showName string, season, ep int64) ([]ProviderResult, error)
TvSearch searches for a given tv show with optional episode and season constraints.
API: t=tvsearch&q=beverly%20hillbillies&season=3&ep=1
?t=tvsearch&rid=5615&cat=5030,5070. Include &extended=1 to return extended information in the search results.
type Provider ¶
type Provider interface { Name() string TvSearch(string, int64, int64) ([]ProviderResult, error) //need better name //Get file contents, leave it to something else to save it to disk GetURL(URL string) (string, []byte, error) // Return what kind of providers this is for: NZB/Torrent Type() ProviderType // Get new items on the provider. Will usually mean hitting a rss feed or // something. GetNewItems() ([]ProviderResult, error) }
Provider defines the interface a tv2go provider must implement
type ProviderPoller ¶
type ProviderPoller struct { Interval time.Duration ResponseChan chan (ProviderResult) Provider Provider LastPoll time.Time DBH *db.Handle // contains filtered or unexported fields }
ProviderPoller wraps the functionality to poll a Provider on a given interval.
func NewProviderPoller ¶
func NewProviderPoller(p Provider, interval time.Duration, dbh *db.Handle, respChan chan (ProviderResult)) *ProviderPoller
NewProviderPoller returns a new configured ProviderPoller ready to use.
func (*ProviderPoller) Poll ¶
func (p *ProviderPoller) Poll()
Poll is designed to be run in a goroutine and polls the Provider for new items returning responses on p.ResponseChannel()
type ProviderRegistry ¶
ProviderRegistry provides an easy way to map providers to string names
func (ProviderRegistry) Search ¶
func (pr ProviderRegistry) Search(showname string, season, epnum int64) []ProviderResult
type ProviderResult ¶
type ProviderResult struct { Type ProviderType `json:"type"` Age *time.Time `json:"age,omitempty"` //hours Name string `json:"name"` Size int64 `json:"size"` Quality string `json:"quality"` ProviderName string `json:"indexer"` URL string `json:"url"` Seeders int64 `json:"seeders"` TVRageID int64 `json:"tvrage_id"` TVDBID int64 `json:"tvdb_id"` Season string `json:"season"` Episode string `json:"episode"` Anime bool `json:"anime"` }
ProviderResult describes the information that Providers will return from searches
type ProviderType ¶
type ProviderType int
ProviderType is for the constants below
const ( NZB ProviderType = 0 + iota TORRENT UNKNOWN )
Different kinds of providers
func ProviderTypeFromString ¶
func ProviderTypeFromString(s string) (ProviderType, error)
ProviderTypeFromString converts a string name to a ProviderType
func (ProviderType) String ¶
func (t ProviderType) String() string
String() function will return the english name that we want out constant Day be recognized as
type TorrentProvider ¶
type TorrentProvider struct {
*BaseProvider
}
TorrentProvider is the base type for Torrent based providers
func (*TorrentProvider) Type ¶
func (t *TorrentProvider) Type() ProviderType