Skip to content

premshree/go-flickr-backup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

Intoduction

Go Flickr Backup is a simple command-line tool, written in the Go Programming language (golang), to backup your Flickr photos from photosets, written in Go. It doesn't do everything, but you should be able to modify it fairly easily.

Features

  • Retries for photo downloads

Requirements

  • You need Go
  • Patched version of go-flickr, forked from the original to add OAuth support
  • pester, which is a nifty little library that allows HTTP retries (and more).

Installing

Make sure to install the requisites:

go get github.com/premshree/go-flickr
go get github.com/sethgrid/pester

Simply clone this repository first. Before you build backup, make sure to edit the following settings:

const (
        API_KEY             = "YOUR-API-KEY"
        API_SECRET          = "YOU-API-SECRET"
        PHOTO_SIZE_ORIGINAL = "Original"
        BACKUP_DIR          = "/path/to/backup-dir"
        CONFIG_PATH         = "/path/to/config"
)

Once you've done that, you are ready to build:

go build backup.go

Screenshots

First run

The first time you run backup, it will need you to authorize the tool with Flickr with read permissions. This is so the tool can backup private photosets and photos.

image Simply follow the link generated there. You'll be taken to a page on Flickr that looks like so:

image

Backing up photosets

Once you authenticate with Flickr, flickr-backup stores the OAuth Token and Secret in a config file that it can reuse for future runs.

image

backup will spawn multiple goroutines to process your photosets and download photos for those sets. At the end up of the run, the program will exit, with some information on total errors during the run.

image

Note: by default, backup will download 10 photosets at page 1. (If you have a total of 30 photosets, you have 3 "pages".) You can explicitly specify the page and photoset like so:

./backup -photosets=10 -page=26

You could just download all your sets at once. The number of sets you have, the number of photos in each set, and the size of photos in sets will affect the count of errors you may encounter.

Backing up photos not in sets

You can also download photos that are not in sets using the -notinset flag:

./backup -notinset -per-page 10

Contributing

The code here isn't as clean as I'd like, but it's pretty straightfoward to play around with. Time permitting, I intend to continue to make it better. But... I'd love contributions - pull requests welcome. I'm also relatively new to Go, so I'm looking forward to up my idiomatic Go chops.

About

Tool to backup Flickr photos to disk

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages