Documentation ¶
Index ¶
- Constants
- Variables
- func Check(e error)
- func DownloadFile(path string, rawurl string, bar *uiprogress.Bar, wg *sync.WaitGroup)
- func FetchConfig(ctx *cli.Context, conf *Settings)
- func GetAndStoreImages(sites map[string][]string, directory string)
- func GetUserHomeDir() string
- func ShowDownloadProgress(done chan int64, bar *uiprogress.Bar, path string, total int64)
- type DesktopprAPIResponse
- type DesktopprImage
- type DesktopprResponseURL
- type Image
- type Settings
- type UnsplashImage
Constants ¶
const NOOFIMAGES = 5
NOOFIMAGES denotes the number of images to be downloaded per Website URL.
Variables ¶
var ConfigPath = filepath.Join(GetUserHomeDir(), ".uipgo.json")
ConfigPath contains the path for uipgo configuration.
Functions ¶
func DownloadFile ¶
DownloadFile downloads a file from the given url and stores it in filepath
func FetchConfig ¶ added in v0.0.3
FetchConfig retrieves intial configuration into the Settings object.
func GetAndStoreImages ¶
GetAndStoreImages downloads and stores images from given websites.
func GetUserHomeDir ¶ added in v0.0.3
func GetUserHomeDir() string
GetUserHomeDir returns the current user's home directory.
func ShowDownloadProgress ¶ added in v0.0.3
func ShowDownloadProgress( done chan int64, bar *uiprogress.Bar, path string, total int64, )
ShowDownloadProgress shows the download progress through the bar provided.
Types ¶
type DesktopprAPIResponse ¶
type DesktopprAPIResponse struct {
Images []DesktopprImage `json:"response"`
}
DesktopprAPIResponse represents a list of DesktopprImages from the API response on https://api.desktoppr.co
type DesktopprImage ¶
type DesktopprImage struct {
Image DesktopprResponseURL `json:"image"`
}
DesktopprImage represents an image on https://desktoppr.co
func (DesktopprImage) Name ¶
func (i DesktopprImage) Name() string
Name retrieves the name of DesktopprImage
func (DesktopprImage) URL ¶
func (i DesktopprImage) URL() string
URL retrieves the url of DesktopprImage
type DesktopprResponseURL ¶
type DesktopprResponseURL struct {
URL string `json:"url"`
}
DesktopprResponseURL contains the actual URL field for DesktopprImage
type Image ¶
Image is a golang representation for image metadata.
func GetDesktopprImages ¶
GetDesktopprImages gets a list of images from provided Desktoppr API endpoint.
type Settings ¶ added in v0.0.3
type Settings struct {
StoragePath string `json:"storage_path"`
}
Settings contains the configuration for uipgo.
type UnsplashImage ¶
UnsplashImage represents an image from https://unsplash.com
func (UnsplashImage) Name ¶
func (i UnsplashImage) Name() string
Name retrieves the name of UnsplashImage
func (UnsplashImage) URL ¶
func (i UnsplashImage) URL() string
URL retrieves the url of UnsplashImage