imgurfetch

package module
v0.0.0-...-5b6ea31 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2020 License: MIT Imports: 11 Imported by: 0

README

PkgGoDev Go Go Report Card

Imgurfetch

Download images from album by album URL.

imgurfetch -h

Usage of imgurfetch:
imgurfetch [arguments] <url> [path(default: .)]
  -g	group images by resolution
  -r duration
    	rate limit(how often requests could happen)
  -w int
    	number of workers (default 10)

Test and build

make all

Will build binary file into $BINARY_FOLDER(defaut:./bin )

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Album

type Album struct {
	Data struct {
		Images []Image `json:"images"`
	} `json:"data"`
}

Album - information about images in the album.

func AlbumMeta

func AlbumMeta(host, id string) (data Album, err error)

AlbumMeta downloads information about images in the album by album ID.

type Image

type Image struct {
	Hash   string `json:"hash"`
	Title  string `json:"title"`
	Width  int    `json:"width"`
	Height int    `json:"height"`
	Ext    string `json:"ext"`
}

Image - information about image.

type ImageWorker

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

ImageWorker - contains information about how to download images and where to store them. Worker receives tasks from "in" channel. when task is done it send signal to "done" channel. Before each task it asks limiter to get permission for execution.

func NewWorker

func NewWorker(host string, in <-chan Image, done chan<- struct{}, path string, grByRes bool, l *rate.Limiter, hc *http.Client) *ImageWorker

NewWorker create new worker instance. If grByRes is true, it will create sub directory WxH.

func (*ImageWorker) Run

func (w *ImageWorker) Run(ctx context.Context)

Run loop which waits tasks in "in" channel until ctx signals done. Before executing tasks it asks limiter for permission.

Directories

Path Synopsis
Download images from album by album URL.
Download images from album by album URL.

Jump to

Keyboard shortcuts

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