Sha256: 1220d126f65a8eb0f2101a19199dc80298faf9ceff3516b1a2bf179b35640d19

Contents?: true

Size: 835 Bytes

Versions: 17

Compression:

Stored size: 835 Bytes

Contents

# Download photos example
# Matthew Epler, Sept 2012

require "picasa"
require "open-uri"

username = "user@gmail.com"
dir = "/Users/path.../"

begin
  client = Picasa::Client.new(:user_id => username)
  albums = client.album.list.entries

  albums.each do |album|
  	Dir.chdir(dir)
  	this_album = client.album.show(album.id).entries
  	Dir.mkdir(album.title)
  	Dir.chdir(album.title)

		for photo in this_album
			begin
				get_string = photo.content.src
				puts "processing" << photo.id

			rescue Exception => e
				puts photo.id << "  **ERROR**"
				puts e
			end

		  open(get_string) do |f|
 				File.open(photo.title, "wb") do |file|
          file.puts f.read
 			  end
		  end
		  puts "======================================"
		end
  end

rescue Picasa::ForbiddenError
  puts "You have the wrong user_id or password."
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
picasa-0.8.0 examples/download_all_albums.rb
picasa-0.7.5 examples/download_all_albums.rb
picasa-0.7.4 examples/download_all_albums.rb
picasa-0.7.3 examples/download_all_albums.rb
picasa-0.7.2 examples/download_all_albums.rb
picasa-0.7.1 examples/download_all_albums.rb
picasa-0.7.0 examples/download_all_albums.rb
picasa-0.6.7 examples/download_all_albums.rb
picasa-0.6.6 examples/download_all_albums.rb
picasa-0.6.5 examples/download_all_albums.rb
picasa-0.6.4 examples/download_all_albums.rb
picasa-0.6.3 examples/download_all_albums.rb
picasa-0.6.2 examples/download_all_albums.rb
picasa-0.6.1 examples/download_all_albums.rb
picasa-0.6.0 examples/download_all_albums.rb
picasa-0.5.4 examples/download_all_albums.rb
picasa-0.5.3 examples/download_all_albums.rb