flickr_airlift 0.1.1 → 0.2.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/bin/flickr_airlift CHANGED
File without changes
data/bin/flickr_uplift CHANGED
File without changes
@@ -48,7 +48,7 @@ module FlickrAirlift
48
48
  end
49
49
 
50
50
  def self.upload(relative_url = ".")
51
- establish_session("write")
51
+ establish_session
52
52
 
53
53
  image_file_names = Dir.entries(relative_url).find_all{ |file_name| UPLOADABLE_FORMATS.any?{ |extension| file_name.downcase.include?(extension)} }
54
54
  uploaded_ids = []
@@ -67,25 +67,39 @@ module FlickrAirlift
67
67
  Launchy.open(edit_url)
68
68
  end
69
69
 
70
- def self.establish_session(permission = "read")
70
+ def self.establish_session
71
+ auth_file = File.expand_path("~/.flick_airliftrc")
71
72
  FlickRaw.api_key = "d4d152785af1b0ea68a5a2d173c75707"
72
73
  FlickRaw.shared_secret = "b9da0b4f99507dd0"
73
- frob = flickr.auth.getFrob
74
- auth_url = FlickRaw.auth_url :frob => frob, :perms => permission
75
74
 
76
- puts " "
77
- puts "opening your browser..."
78
- sleep 1
79
- puts "Come back and press Enter when you are finished"
80
- sleep 2
81
- Launchy.open(auth_url)
82
-
83
- STDIN.getc
84
-
85
- # Authentication
86
- auth = flickr.auth.getToken :frob => frob
87
- login = flickr.test.login
88
- puts "You are now authenticated as #{login.username} with token #{auth.token}"
75
+ if File.exists?(auth_file)
76
+ puts "authenticating thought #{auth_file}"
77
+ data = YAML.load_file(auth_file)
78
+ auth = flickr.auth.checkToken :auth_token => data["api_token"]
79
+ else
80
+ frob = flickr.auth.getFrob
81
+ auth_url = FlickRaw.auth_url :frob => frob, :perms => "write"
82
+
83
+ puts " "
84
+ puts "opening your browser..."
85
+ sleep 1
86
+ puts "Come back and press Enter when you are finished"
87
+ sleep 2
88
+ Launchy.open(auth_url)
89
+
90
+ STDIN.getc
91
+
92
+ # Authentication
93
+ auth = flickr.auth.getToken :frob => frob
94
+ login = flickr.test.login
95
+
96
+ puts auth.token
97
+
98
+ require 'yaml'
99
+ data = {}
100
+ data["api_token"] = auth.token
101
+ File.open(auth_file, "w"){|f| YAML.dump(data, f) }
102
+ end
89
103
  end
90
104
 
91
105
  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: 25
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 1
9
- - 1
10
- version: 0.1.1
8
+ - 2
9
+ - 0
10
+ version: 0.2.0
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: 2011-05-24 00:00:00 -04:00
18
+ date: 2011-07-24 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -50,7 +50,7 @@ dependencies:
50
50
  version: 0.8.4
51
51
  type: :runtime
52
52
  version_requirements: *id002
53
- description: A Command-Line tool for scraping any user's original photos
53
+ description: A Command-Line tool for scraping any user's original photos OR uploading all photos from a given directory
54
54
  email:
55
55
  - beholdthepanda@gmail.com
56
56
  executables:
@@ -97,6 +97,6 @@ rubyforge_project: nowarning
97
97
  rubygems_version: 1.3.7
98
98
  signing_key:
99
99
  specification_version: 3
100
- summary: A Command-Line tool for scraping any user's original photos
100
+ summary: A Command-Line tool for scraping any user's original photos OR uploading all photos from a given directory
101
101
  test_files: []
102
102