flickr_airlift 0.2.1 → 0.3.0
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.
- data/.gitignore +18 -0
- data/Gemfile +8 -0
- data/README.md +29 -0
- data/README.textile +40 -0
- data/Rakefile +1 -0
- data/flickr_airlift.gemspec +24 -0
- data/lib/flickr_airlift.rb +11 -8
- data/lib/flickr_airlift/version.rb +3 -0
- metadata +58 -69
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
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
|
data/README.textile
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
h1. flickr_airlift & flickr_uplift
|
2
|
+
|
3
|
+
h3. Install
|
4
|
+
|
5
|
+
sudo gem install flickr_airlift
|
6
|
+
|
7
|
+
h3. Requirements
|
8
|
+
|
9
|
+
# 'flickraw' and 'launchy' gems
|
10
|
+
# A Flickr account
|
11
|
+
# A good internet connection and patience
|
12
|
+
|
13
|
+
h1. Flickr Airlift
|
14
|
+
|
15
|
+
Flickr Airlift is a command line tool to scrape all of a user's photos.
|
16
|
+
It comes with the bin flickr_airlift which will dump all photos in a directory
|
17
|
+
named after the user.
|
18
|
+
|
19
|
+
h2. Usage
|
20
|
+
|
21
|
+
Relax slim...use the @flickr_airlift@ bin and let the app have its way
|
22
|
+
Here's an "example session":https://gist.github.com/0cd071320f022c06dc23
|
23
|
+
|
24
|
+
------------------------------------------------------------------------------------
|
25
|
+
|
26
|
+
h1. Flickr Uplift
|
27
|
+
|
28
|
+
Flickr Uplift is a command line tool to bulk upload all photos in a given directory.
|
29
|
+
By default they will all be public.
|
30
|
+
|
31
|
+
h2. Usage
|
32
|
+
|
33
|
+
Relax slim...use the @flickr_uplift@ bin and let the app have its way
|
34
|
+
Here's an "example session":https://gist.github.com/61c9b299fdbae112dc26
|
35
|
+
|
36
|
+
This product uses the Flickr API but is not endorsed or certified by Flickr.
|
37
|
+
|
38
|
+
h1. Stored Authentication.
|
39
|
+
|
40
|
+
Once flickr_airlift authenticates you - it stores your authentication in ~/.flick_airliftrc
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'flickr_airlift/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "flickr_airlift"
|
8
|
+
gem.version = FlickrAirlift::VERSION
|
9
|
+
gem.authors = ["nodanaonlyzuul"]
|
10
|
+
gem.email = ["beholdthepanda@gmail.com"]
|
11
|
+
gem.description = "A Command-Line tool for scraping any user's original photos OR uploading all photos from a given directory"
|
12
|
+
gem.summary = "A Command-Line tool for scraping any user's original photos OR uploading all photos from a given directory"
|
13
|
+
gem.homepage = "https://github.com/nodanaonlyzuul/flickr_airlift"
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
|
20
|
+
gem.add_dependency('launchy', '0.4.0')
|
21
|
+
gem.add_dependency('flickraw', '0.8.4')
|
22
|
+
|
23
|
+
gem.rubyforge_project = 'nowarning'
|
24
|
+
end
|
data/lib/flickr_airlift.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
+
require "flickr_airlift/version"
|
1
2
|
require 'flickraw'
|
2
3
|
require 'net/http'
|
3
4
|
require 'cgi'
|
4
5
|
require 'launchy'
|
6
|
+
require 'yaml'
|
5
7
|
|
6
8
|
module FlickrAirlift
|
7
9
|
|
@@ -30,12 +32,15 @@ module FlickrAirlift
|
|
30
32
|
(1..page_count.to_i).each do |page_number|
|
31
33
|
puts "* PAGE #{page_number} of #{page_count}"
|
32
34
|
flickr.photos.search(:user_id => user_id, :page => page_number).each_with_index do |photo, i|
|
33
|
-
|
34
|
-
|
35
|
-
|
35
|
+
|
36
|
+
photo_id = photo.id
|
37
|
+
info = flickr.photos.getInfo(:photo_id => photo_id)
|
38
|
+
photo_size_objects = flickr.photos.getSizes(:photo_id => photo_id)
|
39
|
+
|
40
|
+
download_url = flickr.photos.getSizes(:photo_id => photo_id).find{|size| size.label == "Original"}.source
|
36
41
|
|
37
42
|
puts "** Downloading #{i+1}: #{photo.title} from #{download_url}"
|
38
|
-
File.open(File.join(scraped_user, "#{
|
43
|
+
File.open(File.join(scraped_user, "#{info.title}#{File.extname(download_url)}"), 'wb') do |file|
|
39
44
|
file.puts Net::HTTP.get_response(URI.parse(download_url)).body
|
40
45
|
end
|
41
46
|
|
@@ -68,12 +73,12 @@ module FlickrAirlift
|
|
68
73
|
end
|
69
74
|
|
70
75
|
def self.establish_session
|
71
|
-
auth_file = File.
|
76
|
+
auth_file = File.join(Dir.home(), ".flick_airliftrc")
|
72
77
|
FlickRaw.api_key = "3b2360cc04947af8cf59f51c47a6a8e4"
|
73
78
|
FlickRaw.shared_secret = "405549bcec106815"
|
74
79
|
|
75
80
|
if File.exists?(auth_file)
|
76
|
-
puts "authenticating
|
81
|
+
puts "authenticating through #{auth_file}...if this fails - delete this file"
|
77
82
|
data = YAML.load_file(auth_file)
|
78
83
|
auth = flickr.auth.checkToken :auth_token => data["api_token"]
|
79
84
|
else
|
@@ -94,8 +99,6 @@ module FlickrAirlift
|
|
94
99
|
login = flickr.test.login
|
95
100
|
|
96
101
|
puts auth.token
|
97
|
-
|
98
|
-
require 'yaml'
|
99
102
|
data = {}
|
100
103
|
data["api_token"] = auth.token
|
101
104
|
File.open(auth_file, "w"){|f| YAML.dump(data, f) }
|
metadata
CHANGED
@@ -1,102 +1,91 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: flickr_airlift
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 2
|
9
|
-
- 1
|
10
|
-
version: 0.2.1
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.0
|
5
|
+
prerelease:
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
13
|
-
-
|
7
|
+
authors:
|
8
|
+
- nodanaonlyzuul
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2013-01-04 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
22
15
|
name: launchy
|
23
|
-
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
25
17
|
none: false
|
26
|
-
requirements:
|
27
|
-
- -
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
hash: 15
|
30
|
-
segments:
|
31
|
-
- 0
|
32
|
-
- 4
|
33
|
-
- 0
|
18
|
+
requirements:
|
19
|
+
- - '='
|
20
|
+
- !ruby/object:Gem::Version
|
34
21
|
version: 0.4.0
|
35
22
|
type: :runtime
|
36
|
-
version_requirements: *id001
|
37
|
-
- !ruby/object:Gem::Dependency
|
38
|
-
name: flickraw
|
39
23
|
prerelease: false
|
40
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
25
|
none: false
|
42
|
-
requirements:
|
43
|
-
- -
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
26
|
+
requirements:
|
27
|
+
- - '='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.4.0
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: flickraw
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - '='
|
36
|
+
- !ruby/object:Gem::Version
|
50
37
|
version: 0.8.4
|
51
38
|
type: :runtime
|
52
|
-
|
53
|
-
|
54
|
-
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - '='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.8.4
|
46
|
+
description: A Command-Line tool for scraping any user's original photos OR uploading
|
47
|
+
all photos from a given directory
|
48
|
+
email:
|
55
49
|
- beholdthepanda@gmail.com
|
56
|
-
executables:
|
50
|
+
executables:
|
57
51
|
- flickr_airlift
|
58
52
|
- flickr_uplift
|
59
53
|
extensions: []
|
60
|
-
|
61
54
|
extra_rdoc_files: []
|
62
|
-
|
63
|
-
|
55
|
+
files:
|
56
|
+
- .gitignore
|
57
|
+
- Gemfile
|
58
|
+
- README.md
|
59
|
+
- README.textile
|
60
|
+
- Rakefile
|
64
61
|
- bin/flickr_airlift
|
65
62
|
- bin/flickr_uplift
|
63
|
+
- flickr_airlift.gemspec
|
66
64
|
- lib/flickr_airlift.rb
|
67
|
-
|
65
|
+
- lib/flickr_airlift/version.rb
|
68
66
|
homepage: https://github.com/nodanaonlyzuul/flickr_airlift
|
69
67
|
licenses: []
|
70
|
-
|
71
68
|
post_install_message:
|
72
69
|
rdoc_options: []
|
73
|
-
|
74
|
-
require_paths:
|
70
|
+
require_paths:
|
75
71
|
- lib
|
76
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
72
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
77
73
|
none: false
|
78
|
-
requirements:
|
79
|
-
- -
|
80
|
-
- !ruby/object:Gem::Version
|
81
|
-
|
82
|
-
|
83
|
-
- 0
|
84
|
-
version: "0"
|
85
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
79
|
none: false
|
87
|
-
requirements:
|
88
|
-
- -
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
|
91
|
-
segments:
|
92
|
-
- 0
|
93
|
-
version: "0"
|
80
|
+
requirements:
|
81
|
+
- - ! '>='
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
94
84
|
requirements: []
|
95
|
-
|
96
85
|
rubyforge_project: nowarning
|
97
|
-
rubygems_version: 1.
|
86
|
+
rubygems_version: 1.8.24
|
98
87
|
signing_key:
|
99
88
|
specification_version: 3
|
100
|
-
summary: A Command-Line tool for scraping any user's original photos OR uploading
|
89
|
+
summary: A Command-Line tool for scraping any user's original photos OR uploading
|
90
|
+
all photos from a given directory
|
101
91
|
test_files: []
|
102
|
-
|