lib/flickr_airlift.rb in flickr_airlift-0.4.3 vs lib/flickr_airlift.rb in flickr_airlift-0.5.0

- old
+ new

@@ -2,16 +2,13 @@ require "flickr_airlift/downloader" require 'flickr_authentication' require 'net/http' require 'cgi' require 'highline/import' -require 'yaml' module FlickrAirlift - UPLOADABLE_FORMATS = [".jpg", ".jpeg", ".gif", ".png", ".mov", ".avi"] - def self.download begin establish_session @@ -45,35 +42,15 @@ FlickrAirlift::Downloader.download(user, photoset) exit end end - menu.choice("Quit") { exit } + menu.choice("Quit") { exit } end rescue FlickRaw::FailedResponse => e puts e.msg end - end - - def self.upload(relative_url = ".") - establish_session - - 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(',')}" - - Launchy.open(edit_url) end def self.establish_session fa = FlickrAuthentication.new(key: '3b2360cc04947af8cf59f51c47a6a8e4', shared_secret: '405549bcec106815', auth_file: File.join(Dir.home, ".flick_airliftrc")) fa.authenticate