lib/flickr_airlift.rb in flickr_airlift-0.0.5 vs lib/flickr_airlift.rb in flickr_airlift-0.0.6
- old
+ new
@@ -45,17 +45,20 @@
end
def self.upload(relative_url)
establish_session("write")
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") }
-
+ 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}"
- flickr.upload_photo File.join(relative_url, file_name), :title => file_name.split(".").first
+ uploaded_ids << flickr.upload_photo(File.join(relative_url, file_name), :title => file_name.split(".").first)
end
- # TODO: Go to page
+ 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")
end
def self.establish_session(permission = "read")
FlickRaw.api_key = "d4d152785af1b0ea68a5a2d173c75707"
FlickRaw.shared_secret = "b9da0b4f99507dd0"
\ No newline at end of file