Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AlbumMetadata ¶
type AlbumMetadata = meta.AlbumMetadata
AlbumMetadata contains data about an album.
type DownloadOptions ¶
type DownloadOptions struct { // MaxImages is the maximum number of images to download. 0 for all. MaxImages int // MaxPages is the maximum number of pages to download. 0 for all. MaxPages int // Parallel is the maximum number of image to download concurrently. Parallel int // ToFolder is the destination folder to download images to. ToFolder string // FilenameTemplate is a golang template for generating the filename to write to. FilenameTemplate string // FilterSubAlbum is the name of the subalbum to filter. If this is non-empty, // then only images from the specified SubAlbum will be downloaded. FilterSubAlbum string // Params is parameters to pass down to the providers. Params map[string]string }
DownloadOptions is an object that can be passed to an ImageDownloader to specify options when downloading an album.
type ImageCallback ¶
type ImageCallback = providers.ImageCallback
ImageCallback is a function called by a Provider for each image in an album. This will be called once for each image, and then with `album, nil, nil` when there are no more images.
If an error occurs fetching images, this will be called with err set.
Implemnetations can return false to stop the Provider from providing any further images.
type ImageDownloader ¶
type ImageDownloader interface { // DownloadAlbum will download all images in an album. DownloadAlbum( url string, options DownloadOptions, reporter ProgressReporter, ) // DownloadImage will download an individual image from an album. DownloadImage( image *ImageMetadata, toFolder string, filenameTemplate string, reporter ProgressReporter, ) // Wait will block until all albums/images currently being downloaded are // done downloading. Wait() // Close will shut down an ImageDownloader and prevent any further downloads. Close() // IsClosed will return true if this downloader has been closed. IsClosed() bool // contains filtered or unexported methods }
ImageDownloader is an object that can download images.
func NewConcurrentDownloader ¶
func NewConcurrentDownloader(options ...Option) ImageDownloader
NewConcurrentDownloader returns an instance of ImageDownloader which will download multiple images simultaneously in goroutines. `maxConcurrent` is the maximum number of concurrent downloads to allow at the same time.
type ImageMetadata ¶
type ImageMetadata = meta.ImageMetadata
ImageMetadata contains data about an image inside an album.
type Option ¶
type Option func(*concurrentDownloader)
Option is an option that can be passed to NewConcurrnetDownloader().
func SetMaxConcurrency ¶
SetMaxConcurrency is an option for NewConcurrentDownloader which sets the maximum number of goroutines which will be spawned to download files.
func SetMinSize ¶
SetMinSize is an option that sets the minimum size, in bytes, of files to download. Any file smaller than this will be skipped. 0 for any size. If the size of a file cannot be determined ahead of time, this will be ignored.
type ProgressReporter ¶
type ProgressReporter interface { AlbumFetch(url string) AlbumStart(album *AlbumMetadata) AlbumEnd(album *AlbumMetadata, err error) ImageSkip(image *ImageMetadata, err error) ImageStart(image *ImageMetadata) ImageProgress(image *ImageMetadata, progress *download.Progress) ImageEnd(image *ImageMetadata, err error) }
ProgressReporter is an interface for receiving progress updates from pixdl.