Sha256: 68f1ae3f445bb69e7185bc26c9fc11f6c776c80c9b42d3799395958b6a986610

Contents?: true

Size: 819 Bytes

Versions: 17

Compression:

Stored size: 819 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

  album = albums.find { |album| album.title == "your_album_name" }
  photos = client.album.show(album.id).entries

  photos.each do |photo|
    begin
  		get_string = photo.content.src
  		puts "processing " << photo.id

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

      Dir.chdir(dir)
			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_one_album.rb
picasa-0.7.5 examples/download_one_album.rb
picasa-0.7.4 examples/download_one_album.rb
picasa-0.7.3 examples/download_one_album.rb
picasa-0.7.2 examples/download_one_album.rb
picasa-0.7.1 examples/download_one_album.rb
picasa-0.7.0 examples/download_one_album.rb
picasa-0.6.7 examples/download_one_album.rb
picasa-0.6.6 examples/download_one_album.rb
picasa-0.6.5 examples/download_one_album.rb
picasa-0.6.4 examples/download_one_album.rb
picasa-0.6.3 examples/download_one_album.rb
picasa-0.6.2 examples/download_one_album.rb
picasa-0.6.1 examples/download_one_album.rb
picasa-0.6.0 examples/download_one_album.rb
picasa-0.5.4 examples/download_one_album.rb
picasa-0.5.3 examples/download_one_album.rb