Documentation ¶
Index ¶
- Variables
- func NewIbitClient(opts IbitClientOptions, cache Cache, logger *zap.Logger, logFoundTorrents bool) *ibitClient
- func NewLeetxClient(opts LeetxClientOptions, cache Cache, metaGetter MetaGetter, ...) *leetxClient
- func NewRARBGclient(opts RARBGclientOptions, cache Cache, logger *zap.Logger, ...) *rarbgClient
- func NewTPBclient(opts TPBclientOptions, cache Cache, metaGetter MetaGetter, logger *zap.Logger, ...) (*tpbClient, error)
- func NewYTSclient(opts YTSclientOptions, cache Cache, logger *zap.Logger, logFoundTorrents bool) *ytsClient
- type Cache
- type CacheItem
- type Client
- type IbitClientOptions
- type InMemoryCache
- type LeetxClientOptions
- type MagnetSearcher
- type Meta
- type MetaGetter
- type RARBGclientOptions
- type Result
- type TPBclientOptions
- type YTSclientOptions
Constants ¶
This section is empty.
Variables ¶
var DefaultIbitClientOpts = IbitClientOptions{ BaseURL: "https://ibit.am", Timeout: 5 * time.Second, CacheAge: 24 * time.Hour, }
var DefaultLeetxClientOpts = LeetxClientOptions{ BaseURL: "https://1337x.to", Timeout: 5 * time.Second, CacheAge: 24 * time.Hour, }
var DefaultRARBGclientOpts = RARBGclientOptions{ BaseURL: "https://torrentapi.org", Timeout: 5 * time.Second, CacheAge: 24 * time.Hour, }
var DefaultTPBclientOpts = TPBclientOptions{ BaseURL: "https://apibay.org", Timeout: 5 * time.Second, CacheAge: 24 * time.Hour, }
var DefaultYTSclientOpts = YTSclientOptions{ BaseURL: "https://yts.mx", Timeout: 5 * time.Second, CacheAge: 24 * time.Hour, }
Functions ¶
func NewIbitClient ¶ added in v0.7.0
func NewIbitClient(opts IbitClientOptions, cache Cache, logger *zap.Logger, logFoundTorrents bool) *ibitClient
func NewLeetxClient ¶ added in v0.7.0
func NewLeetxClient(opts LeetxClientOptions, cache Cache, metaGetter MetaGetter, logger *zap.Logger, logFoundTorrents bool) *leetxClient
func NewRARBGclient ¶ added in v0.9.0
func NewRARBGclient(opts RARBGclientOptions, cache Cache, logger *zap.Logger, logFoundTorrents bool) *rarbgClient
func NewTPBclient ¶ added in v0.7.0
func NewTPBclient(opts TPBclientOptions, cache Cache, metaGetter MetaGetter, logger *zap.Logger, logFoundTorrents bool) (*tpbClient, error)
func NewYTSclient ¶ added in v0.7.0
func NewYTSclient(opts YTSclientOptions, cache Cache, logger *zap.Logger, logFoundTorrents bool) *ytsClient
Types ¶
type Cache ¶ added in v0.7.0
type Cache interface { Set(key string, results []Result) error Get(key string) ([]Result, time.Time, bool, error) }
Cache is the interface that the imdb2torrent clients use for caching results. A package user must pass an implementation of this interface. Usually you create a simple wrapper around an existing cache package. An example implementation is the InMemoryCache in this package.
type CacheItem ¶ added in v0.7.0
CacheItem combines Result objects and a creation time in a single struct. This can be useful for implementing the Cache interface, but is not necessarily required. See the InMemoryCache example implementation of the Cache interface for its usage.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) FindMovie ¶ added in v0.11.0
FindMovie tries to find magnet URLs for the movie identified by the given IMDb ID. It only returns 720p, 1080p, 1080p 10bit, 2160p and 2160p 10bit videos. It caches results once they're found. It can return an empty slice and no error if no actual error occurred (for example if torrents where found but no >=720p videos).
func (*Client) FindTVShow ¶ added in v0.11.0
func (c *Client) FindTVShow(ctx context.Context, imdbID string, season, episode int) ([]Result, error)
FindTVShow tries to find magnet URLs for the TV show identified by the given IMDb ID + season + episode. It only returns 720p, 1080p, 1080p 10bit, 2160p and 2160p 10bit videos. It caches results once they're found. It can return an empty slice and no error if no actual error occurred (for example if torrents where found but no >=720p videos).
func (*Client) GetMagnetSearchers ¶ added in v0.7.0
func (c *Client) GetMagnetSearchers() map[string]MagnetSearcher
type IbitClientOptions ¶ added in v0.7.0
func NewIbitClientOpts ¶ added in v0.7.0
func NewIbitClientOpts(baseURL string, timeout, cacheAge time.Duration) IbitClientOptions
type InMemoryCache ¶ added in v0.7.0
type InMemoryCache struct {
// contains filtered or unexported fields
}
InMemoryCache is an example implementation of the Cache interface. It doesn't persist its data, so it's not suited for production use of the imdb2torrent package.
func NewInMemoryCache ¶ added in v0.8.0
func NewInMemoryCache() *InMemoryCache
NewInMemoryCache creates a new InMemoryCache.
type LeetxClientOptions ¶ added in v0.7.0
func NewLeetxClientOpts ¶ added in v0.7.0
func NewLeetxClientOpts(baseURL string, timeout, cacheAge time.Duration) LeetxClientOptions
type MagnetSearcher ¶ added in v0.7.0
type MetaGetter ¶ added in v0.11.0
type RARBGclientOptions ¶ added in v0.9.0
func NewRARBGclientOpts ¶ added in v0.9.0
func NewRARBGclientOpts(baseURL string, timeout, cacheAge time.Duration) RARBGclientOptions
type TPBclientOptions ¶ added in v0.7.0
type TPBclientOptions struct { BaseURL string SocksProxyAddr string Timeout time.Duration CacheAge time.Duration }
func NewTPBclientOpts ¶ added in v0.7.0
func NewTPBclientOpts(baseURL, socksProxyAddr string, timeout, cacheAge time.Duration) TPBclientOptions
type YTSclientOptions ¶ added in v0.7.0
func NewYTSclientOpts ¶ added in v0.7.0
func NewYTSclientOpts(baseURL string, timeout, cacheAge time.Duration) YTSclientOptions