X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=src%2Fopen_uri_downloader.rb;h=e55c0fa7d0e60635b29b1d27b2f843f27da2d873;hb=05f6c664ebd77e194656a828855d74d2c4959d85;hp=44ea03776a95cf3da19e0b4e2303a1fa7b5a572b;hpb=e3eeb8df887fc68959ab7d7ebae5c0206b79c230;p=dead%2Fwhatever-dl.git diff --git a/src/open_uri_downloader.rb b/src/open_uri_downloader.rb index 44ea037..e55c0fa 100644 --- a/src/open_uri_downloader.rb +++ b/src/open_uri_downloader.rb @@ -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