collector

package
v0.0.0-...-4b28c8f Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hash

func Hash(d Downloadable) string

Types

type CollectorConfig

type CollectorConfig struct {
	HTTP      HttpConfig
	PageCount int
}

type CollectorOption

type CollectorOption func(*CollectorConfig) error

func WithHTTPConfig

func WithHTTPConfig(http HttpConfig) CollectorOption

func WithPageCount

func WithPageCount(page int) CollectorOption

type Downloadable

type Downloadable interface {
	fmt.Stringer
	Name() string
	URI() string
	Size() uint64
	Date() time.Time
}

Downloadable is an interface that defines a method to get the name and URI of a downloadable.

type DownloadableCollector

type DownloadableCollector interface {
	Collect(ctx context.Context) ([]Downloadable, error)
}

DownloadableCollector is an interface that defines a method to collect downloadables.

func Factory

func Factory(source Source) (DownloadableCollector, error)

type Downloader

type Downloader interface {
	Download(d Downloadable) error
}

Downloader is an interface that defines a method to open a downloadable.

type HttpConfig

type HttpConfig struct {
	UserAgent   string
	DNSResolver string
	DNSProto    string
	DNSTimeout  int
	Insecure    bool
	RetryMax    int
}

func (*HttpConfig) SetDefaultsOnEmptyFields

func (cfg *HttpConfig) SetDefaultsOnEmptyFields()

type Magnet

type Magnet struct {
	// contains filtered or unexported fields
}

func NewMagnet

func NewMagnet(name, uri string) *Magnet

func (Magnet) Date

func (m Magnet) Date() time.Time

func (Magnet) Name

func (m Magnet) Name() string

func (Magnet) Size

func (m Magnet) Size() uint64

func (Magnet) String

func (m Magnet) String() string

func (Magnet) URI

func (m Magnet) URI() string

type MagnetCollector

type MagnetCollector struct {
	// contains filtered or unexported fields
}

func NewMagnetCollector

func NewMagnetCollector(uri string, opts ...CollectorOption) (*MagnetCollector, error)

func (*MagnetCollector) Collect

func (c *MagnetCollector) Collect(ctx context.Context) ([]Downloadable, error)

type MagnetDLMagnetCollector

type MagnetDLMagnetCollector struct {
	// contains filtered or unexported fields
}

func NewMagnetDLMagnetCollector

func NewMagnetDLMagnetCollector(uri string, opts ...CollectorOption) (*MagnetDLMagnetCollector, error)

func (*MagnetDLMagnetCollector) Collect

type NyaaMagnetCollector

type NyaaMagnetCollector struct {
	// contains filtered or unexported fields
}

func NewNyaaMagnetCollector

func NewNyaaMagnetCollector(uri string, opts ...CollectorOption) (*NyaaMagnetCollector, error)

func (*NyaaMagnetCollector) Collect

func (c *NyaaMagnetCollector) Collect(ctx context.Context) ([]Downloadable, error)

type Source

type Source struct {
	Type string
	URIs []string
}

func (Source) Collector

func (s Source) Collector() (DownloadableCollector, error)

type TransmissionConfig

type TransmissionConfig struct {
	Host string
	Port string
	User string
	Pass string
	SSL  bool
}

type TransmissionDownloader

type TransmissionDownloader struct {
	Transmission *TransmissionConfig
	// contains filtered or unexported fields
}

TransmissionDownloader is a type that implements the Downloader interface to open a downloadable using xdg-open.

func NewTransmissionDownloader

func NewTransmissionDownloader(connection *TransmissionConfig) *TransmissionDownloader

NewTransmissionDownloader creates a new TransmissionDownloader

func (*TransmissionDownloader) Download

func (d *TransmissionDownloader) Download(dl Downloadable) error

Download does an http post to a trasmission server to download the torrent file

type WebTorrentDownloader

type WebTorrentDownloader struct{}

WebTorrentDownloader is a type that implements the Downloader interface to open a downloadable using WebTorrent-open.

func (WebTorrentDownloader) Download

func (d WebTorrentDownloader) Download(dl Downloadable) error

Download opens the URI of the downloadable using WebTorrent-open.

type XDGDownloader

type XDGDownloader struct{}

XDGDownloader is a type that implements the Downloader interface to open a downloadable using xdg-open.

func (XDGDownloader) Download

func (d XDGDownloader) Download(dl Downloadable) error

Download opens the URI of the downloadable using xdg-open.

Jump to

Keyboard shortcuts

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