lib/flickr_airlift.rb in flickr_airlift-0.0.8 vs lib/flickr_airlift.rb in flickr_airlift-0.0.9
- old
+ new
@@ -45,24 +45,27 @@
rescue FlickRaw::FailedResponse => e
puts e.msg
end
end
- def self.upload(relative_url)
+ 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)} }
+ image_file_names = Dir.entries(relative_url).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|
puts " Uploading (#{index+1} of #{image_file_names.length}): #{file_name}"
uploaded_ids << flickr.upload_photo(File.join(relative_url, file_name), :title => file_name.split(".").first)
end
+
puts "...DONE!"
edit_url = "http://www.flickr.com/photos/upload/edit/?ids=#{uploaded_ids.join(',')}"
- system("which open") ? system("open '#{edit_url}'") : puts(" Go to #{edit_url} to edit your photos more")
+ Launchy.open(edit_url)
end
def self.establish_session(permission = "read")
FlickRaw.api_key = "d4d152785af1b0ea68a5a2d173c75707"
FlickRaw.shared_secret = "b9da0b4f99507dd0"
\ No newline at end of file