10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/flickr_airlift.rb', line 10
def self.download
begin
establish_session
puts "Whose photos would you like to archive?:"
scraped_user = STDIN.gets
scraped_user = scraped_user.strip
begin
user = flickr.people.findByUsername(:username => scraped_user)
user_id = user.id
rescue Exception => e
puts "Hmmmm - unknown user - make sure to use the user's full handle - not the one in the URL. (example: 'Fast & Bulbous' not 'fastandbulbous')"
self.download
end
photo_sets = flickr.photosets.getList(:user_id => user_id).sort_by(&:title)
choose do ||
.prompt = "What do you want to download?"
.choice("~ Entire Photostream ~") do
FlickrAirlift::Downloader.download(user)
exit
end
photo_sets.each do |photoset|
.choice(photoset.title) do
FlickrAirlift::Downloader.download(user, photoset)
exit
end
end
.choice("Quit") { exit }
end
rescue FlickRaw::FailedResponse => e
puts e.msg
end
end
|