lib/flickr_airlift.rb in flickr_airlift-0.0.6 vs lib/flickr_airlift.rb in flickr_airlift-0.0.7
- old
+ new
@@ -1,11 +1,13 @@
require 'flickraw'
require 'net/http'
require 'cgi'
module FlickrAirlift
-
+
+ UPLOADABLE_FORMATS = [".jpg", ".jpeg", ".gif", ".png", ".mov", ".avi"]
+
def self.download
begin
establish_session
# Prompt
@@ -44,10 +46,11 @@
end
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") }
+
+ 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|
puts " Uploading (#{index+1} of #{image_file_names.length}): #{file_name}"
\ No newline at end of file