downloader

package
v0.0.0-...-3856d7f Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package downloader Options defines downloader options

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Downloader

type Downloader struct {
	Options *Options
	// contains filtered or unexported fields
}

Downloader Struct for downloading photos into managed folders, use factory method `NewDownloader` to create

func NewDownloader

func NewDownloader() *Downloader

NewDownloader factory to create a Downloader instance with defaults

func (*Downloader) DownloadAll

func (d *Downloader) DownloadAll(svc *photoslibrary.Service) error

DownloadAll downloads all files

type LibraryItem

type LibraryItem struct {
	//Google Photos item
	photoslibrary.MediaItem
	//Actual file name that was used, without a path
	UsedFileName string
}

LibraryItem Google Photo item and meta data

func (*LibraryItem) MarshalJSON

func (l *LibraryItem) MarshalJSON() ([]byte, error)

MarshalJSON marshal as json

type Options

type Options struct {
	//BackupFolderis the backup folder
	BackupFolder string
	//FolderFormat time format used to format folder structure
	FolderFormat string
	//UseFileName use file name when uploaded to Google Photos
	UseFileName bool
	//OriginalFiles retain EXIF metadata on downloaded images. Location information is not included.
	IncludeEXIF bool
	//MaxItems how many items to download
	MaxItems int
	//number of items to download on per API call
	PageSize int
	//Throttle is time to wait between API calls
	Throttle int
	//DownloadThrottle is the rate to limit downloading of items (KB/sec)
	DownloadThrottle float64
	//ConcurrentDownloads is the number of downloads that can happen at once
	ConcurrentDownloads int
	//Google photos AlbumID
	AlbumID string
	//CredentialsFile Google API credentials.json file
	CredentialsFile string
	//TokenFile Google oauth client token.json file
	TokenFile string
}

Options Defines downloader various options

type Stats

type Stats struct {
	Total      int
	Errors     int
	TotalSize  uint64
	Downloaded int
	Skipped    int
	// contains filtered or unexported fields
}

Stats TODO

func (*Stats) UpdateStatsDownloaded

func (s *Stats) UpdateStatsDownloaded(totalSize uint64, downloaded int)

UpdateStatsDownloaded increment the downloaded items and size of items

func (*Stats) UpdateStatsError

func (s *Stats) UpdateStatsError(errors int)

UpdateStatsError increment the items that produced errors

func (*Stats) UpdateStatsSkipped

func (s *Stats) UpdateStatsSkipped(skipped int)

UpdateStatsError increment the skipped items

func (*Stats) UpdateStatsTotal

func (s *Stats) UpdateStatsTotal(total int)

UpdateStatsTotal increment the total items

Jump to

Keyboard shortcuts

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