Skip to content

Commit

Permalink
adding page-size flag
Browse files Browse the repository at this point in the history
  • Loading branch information
dtylman committed Dec 3, 2018
1 parent e91899f commit caff55c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@
credentials.json
token.json
gitmoo-goog
gitmoo-goog.bz2
gitmoo-goog.zip
4 changes: 3 additions & 1 deletion downloader/downloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ var Options struct {
BackupFolder string
//MaxItems how many items to download
MaxItems int
//number of items to download on per API call
PageSize int
//Throtthle is time to wait between API calls
Throttle int
//Google photos AlbumID
Expand Down Expand Up @@ -132,7 +134,7 @@ func DownloadAll(svc *photoslibrary.Service) error {
stats.errors = 0
stats.total = 0
stats.totalsize = 0
req := &photoslibrary.SearchMediaItemsRequest{PageSize: int64(Options.MaxItems), AlbumId: Options.AlbumID}
req := &photoslibrary.SearchMediaItemsRequest{PageSize: int64(Options.PageSize), AlbumId: Options.AlbumID}
for hasMore {
sleepTime := time.Duration(time.Second * time.Duration(Options.Throttle))
log.Printf("Processed: %v, Downloaded: %v, Errors: %v, Total Size: %v, Waiting %v", stats.total, stats.downloaded, stats.errors, humanize.Bytes(stats.totalsize), sleepTime)
Expand Down
3 changes: 2 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
)

//Version is the version number
const Version = "0.2"
const Version = "0.21"

var options struct {
loop bool
Expand Down Expand Up @@ -121,6 +121,7 @@ func main() {
flag.StringVar(&downloader.Options.BackupFolder, "folder", "", "backup folder")
flag.StringVar(&downloader.Options.AlbumID, "album", "", "download only from this album (use google album id)")
flag.IntVar(&downloader.Options.MaxItems, "max", math.MaxInt32, "max items to download")
flag.IntVar(&downloader.Options.PageSize, "pagesize", 50, "number of items to download on per API call")
flag.IntVar(&downloader.Options.Throttle, "throttle", 5, "Time, in seconds, to wait between API calls")

flag.Parse()
Expand Down

3 comments on commit caff55c

@tamingil
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is anyone able to help build for arm7 Raspberry PI 3 B+. Version 0.21 is perfect for what I need, but I can't seem to get it to build on the PI arch.

@dtylman
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tamingil
Copy link

@tamingil tamingil commented on caff55c Dec 11, 2018 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.