flickr_airlift 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/flickr_uplift +3 -0
- data/lib/flickr_airlift.rb +40 -24
- metadata +6 -4
data/bin/flickr_uplift
ADDED
data/lib/flickr_airlift.rb
CHANGED
@@ -6,30 +6,7 @@ module FlickrAirlift
|
|
6
6
|
|
7
7
|
def self.download
|
8
8
|
begin
|
9
|
-
|
10
|
-
FlickRaw.api_key = "d4d152785af1b0ea68a5a2d173c75707"
|
11
|
-
FlickRaw.shared_secret = "b9da0b4f99507dd0"
|
12
|
-
frob = flickr.auth.getFrob
|
13
|
-
auth_url = FlickRaw.auth_url :frob => frob, :perms => 'read'
|
14
|
-
|
15
|
-
puts " "
|
16
|
-
if system("which open")
|
17
|
-
puts "opening your browser..."
|
18
|
-
sleep 1
|
19
|
-
puts "Come back and press Enter when you are finished"
|
20
|
-
sleep 2
|
21
|
-
system("open '#{auth_url}'")
|
22
|
-
else
|
23
|
-
puts "Open this url in your process to complete the authication process:"
|
24
|
-
puts auth_url
|
25
|
-
puts "Press Enter when you are finished."
|
26
|
-
end
|
27
|
-
STDIN.getc
|
28
|
-
|
29
|
-
# Authentication
|
30
|
-
auth = flickr.auth.getToken :frob => frob
|
31
|
-
login = flickr.test.login
|
32
|
-
puts "You are now authenticated as #{login.username} with token #{auth.token}"
|
9
|
+
establish_session
|
33
10
|
|
34
11
|
# Prompt
|
35
12
|
puts "Exactly who's photos would you like to archive?:"
|
@@ -67,4 +44,43 @@ module FlickrAirlift
|
|
67
44
|
end
|
68
45
|
end
|
69
46
|
|
47
|
+
def self.upload(relative_url)
|
48
|
+
establish_session("write")
|
49
|
+
image_file_names = Dir.entries(".").find_all{ |file_name| file_name.include?(".jpg") || file_name.include?(".jpeg") || file_name.include?(".gif") || file_name.include?(".png") }
|
50
|
+
|
51
|
+
puts "Uploading #{image_file_names.length} files:"
|
52
|
+
sleep 1
|
53
|
+
image_file_names.each_with_index do |file_name, index|
|
54
|
+
puts " Uploading (#{index+1} of #{image_file_names.length}): #{file_name}"
|
55
|
+
flickr.upload_photo File.join(relative_url, file_name), :title => file_name.split(".").first
|
56
|
+
end
|
57
|
+
# TODO: Go to page
|
58
|
+
end
|
59
|
+
|
60
|
+
def self.establish_session(permission = "read")
|
61
|
+
FlickRaw.api_key = "d4d152785af1b0ea68a5a2d173c75707"
|
62
|
+
FlickRaw.shared_secret = "b9da0b4f99507dd0"
|
63
|
+
frob = flickr.auth.getFrob
|
64
|
+
auth_url = FlickRaw.auth_url :frob => frob, :perms => permission
|
65
|
+
|
66
|
+
puts " "
|
67
|
+
if system("which open")
|
68
|
+
puts "opening your browser..."
|
69
|
+
sleep 1
|
70
|
+
puts "Come back and press Enter when you are finished"
|
71
|
+
sleep 2
|
72
|
+
system("open '#{auth_url}'")
|
73
|
+
else
|
74
|
+
puts "Open this url in your process to complete the authication process:"
|
75
|
+
puts auth_url
|
76
|
+
puts "Press Enter when you are finished."
|
77
|
+
end
|
78
|
+
STDIN.getc
|
79
|
+
|
80
|
+
# Authentication
|
81
|
+
auth = flickr.auth.getToken :frob => frob
|
82
|
+
login = flickr.test.login
|
83
|
+
puts "You are now authenticated as #{login.username} with token #{auth.token}"
|
84
|
+
end
|
85
|
+
|
70
86
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flickr_airlift
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 5
|
10
|
+
version: 0.0.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Stephen Schor
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2011-01-01 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|
@@ -24,12 +24,14 @@ email:
|
|
24
24
|
- beholdthepanda@gmail.com
|
25
25
|
executables:
|
26
26
|
- flickr_airlift
|
27
|
+
- flickr_uplift
|
27
28
|
extensions: []
|
28
29
|
|
29
30
|
extra_rdoc_files: []
|
30
31
|
|
31
32
|
files:
|
32
33
|
- bin/flickr_airlift
|
34
|
+
- bin/flickr_uplift
|
33
35
|
- lib/flickr_airlift.rb
|
34
36
|
has_rdoc: true
|
35
37
|
homepage: https://github.com/nodanaonlyzuul/flickr_airlift
|