lib/flickr_airlift.rb in flickr_airlift-0.0.7 vs lib/flickr_airlift.rb in flickr_airlift-0.0.8
- old
+ new
@@ -1,13 +1,14 @@
require 'flickraw'
require 'net/http'
require 'cgi'
+require 'launchy'
module FlickrAirlift
-
+
UPLOADABLE_FORMATS = [".jpg", ".jpeg", ".gif", ".png", ".mov", ".avi"]
-
+
def self.download
begin
establish_session
# Prompt
@@ -46,11 +47,11 @@
end
end
def self.upload(relative_url)
establish_session("write")
-
+
image_file_names = Dir.entries(".").find_all{ |file_name| UPLOADABLE_FORMATS.any?{ |extension| file_name.downcase.include?(extension)} }
uploaded_ids = []
puts "Uploading #{image_file_names.length} files:"
sleep 1
image_file_names.each_with_index do |file_name, index|
@@ -73,10 +74,10 @@
if system("which open")
puts "opening your browser..."
sleep 1
puts "Come back and press Enter when you are finished"
sleep 2
- system("open '#{auth_url}'")
+ Launchy.open(auth_url)
else
puts "Open this url in your process to complete the authication process:"
puts auth_url
puts "Press Enter when you are finished."
end
\ No newline at end of file