flickr_airlift 0.3.2 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
1
  module FlickrAirlift
2
- VERSION = "0.3.2"
2
+ VERSION = "0.3.3"
3
3
  end
@@ -14,24 +14,24 @@ module FlickrAirlift
14
14
  establish_session
15
15
 
16
16
  # Prompt
17
- puts "Exactly who's photos would you like to archive?:"
18
-
17
+ puts "Whose photos would you like to archive?:"
18
+
19
19
  scraped_user = STDIN.gets
20
- scraped_user = scraped_user.strip
21
-
20
+ scraped_user = scraped_user.strip
21
+
22
22
  begin
23
- user_id = flickr.people.findByUsername(:username => scraped_user).id
23
+ user_id = flickr.people.findByUsername(:username => scraped_user).id
24
24
  rescue Exception => e
25
25
  puts "Hmmmm - unknown user - make sure to use the user's full handle - not the one in the URL. (example: 'Fast & Bulbous' not 'fastandbulbous')"
26
26
  self.download
27
27
  end
28
-
29
-
28
+
29
+
30
30
  photos = flickr.photos.search(:user_id => user_id)
31
31
  photo_count = photos.total
32
32
  page_count = photos.pages
33
-
34
- # non-pro users don't have 'Original' sizes available.
33
+
34
+ # non-pro users don't have 'Original' sizes available.
35
35
  ranked_sizes = ['Original', 'Large', 'Medium']
36
36
 
37
37
  # Downloading
@@ -46,14 +46,14 @@ module FlickrAirlift
46
46
  photo_id = photo.id
47
47
  info = flickr.photos.getInfo(:photo_id => photo_id)
48
48
  downloadable_files = flickr.photos.getSizes(:photo_id => photo_id)
49
-
49
+
50
50
  ranked_sizes.each do |size_name|
51
51
  if df = downloadable_files.find { |downloadable_file| downloadable_file.label == size_name }
52
52
  download_url = df.source
53
53
  file_to_write = File.join(scraped_user, "#{photo_id}#{File.extname(download_url)}")
54
-
55
- if File.exists?(file_to_write)
56
- puts "** SKIPPING #{file_to_write} because it exists"
54
+
55
+ if File.exists?(file_to_write) && File.size(file_to_write) > 0
56
+ puts "** SKIPPING #{file_to_write} because it has already been downloaded"
57
57
  else
58
58
  puts "** Downloading #{i+1}: #{photo.title} (#{size_name}) from #{download_url}"
59
59
  File.open(file_to_write, 'wb') { |file| file.puts Net::HTTP.get_response(URI.parse(download_url)).body }
@@ -63,10 +63,9 @@ module FlickrAirlift
63
63
  end
64
64
  end
65
65
  end
66
-
67
- rescue FlickRaw::FailedResponse => e
68
- puts e.msg
69
- end
66
+ rescue FlickRaw::FailedResponse => e
67
+ puts e.msg
68
+ end
70
69
  end
71
70
 
72
71
  def self.upload(relative_url = ".")
@@ -95,17 +94,17 @@ module FlickrAirlift
95
94
  FlickRaw.shared_secret = "405549bcec106815"
96
95
 
97
96
  if File.exists?(auth_file)
98
-
99
- data = YAML.load_file(auth_file)
97
+
98
+ data = YAML.load_file(auth_file)
100
99
 
101
100
  begin
102
- auth = flickr.auth.checkToken :auth_token => data["api_token"]
101
+ auth = flickr.auth.checkToken :auth_token => data["api_token"]
103
102
  rescue Exception => e
104
103
  puts "These was a problem with the credentials in #{auth_file}"
105
104
  puts "Delete the file and try again."
106
105
  exit
107
106
  end
108
-
107
+
109
108
  else
110
109
  frob = flickr.auth.getFrob
111
110
  auth_url = FlickRaw.auth_url :frob => frob, :perms => "write"
@@ -130,4 +129,7 @@ module FlickrAirlift
130
129
  end
131
130
  end
132
131
 
133
- end
132
+ def self.file_path_for_photo(scraped_user, photo_id)
133
+
134
+ end
135
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flickr_airlift
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-05 00:00:00.000000000 Z
12
+ date: 2013-06-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: launchy
@@ -55,7 +55,6 @@ extra_rdoc_files: []
55
55
  files:
56
56
  - .gitignore
57
57
  - Gemfile
58
- - README.md
59
58
  - README.textile
60
59
  - Rakefile
61
60
  - bin/flickr_airlift
data/README.md DELETED
@@ -1,29 +0,0 @@
1
- # FlickrAirlift
2
-
3
- TODO: Write a gem description
4
-
5
- ## Installation
6
-
7
- Add this line to your application's Gemfile:
8
-
9
- gem 'flickr_airlift'
10
-
11
- And then execute:
12
-
13
- $ bundle
14
-
15
- Or install it yourself as:
16
-
17
- $ gem install flickr_airlift
18
-
19
- ## Usage
20
-
21
- TODO: Write usage instructions here
22
-
23
- ## Contributing
24
-
25
- 1. Fork it
26
- 2. Create your feature branch (`git checkout -b my-new-feature`)
27
- 3. Commit your changes (`git commit -am 'Add some feature'`)
28
- 4. Push to the branch (`git push origin my-new-feature`)
29
- 5. Create new Pull Request