]> gitweb.michael.orlitzky.com - dead/whatever-dl.git/blobdiff - src/open_uri_downloader.rb
Allow the downloaders to take advantage of the websites' headers.
[dead/whatever-dl.git] / src / open_uri_downloader.rb
index 44ea03776a95cf3da19e0b4e2303a1fa7b5a572b..e55c0fa7d0e60635b29b1d27b2f843f27da2d873 100644 (file)
@@ -20,14 +20,18 @@ require 'src/uri_utilities'
 
 class OpenUriDownloader < Downloader
 
-  def download(url, outfile)
+  def download(url, outfile, headers = {}, continue = false)
+    if File.exists?(outfile)
+      raise IOError.new("Output file already exists. Please remove #{outfile}, and try again.")
+    end
+
     uri = URI.parse(url)
     
     uu = UriUtilities.new()
     puts "Fetching #{url}"
     puts "Saving as #{outfile}."
     puts ''
-    uu.download_with_progress_bar(uri, outfile)
+    uu.download_with_progress_bar(uri, outfile, headers)
   end
   
 end