]> gitweb.michael.orlitzky.com - dead/whatever-dl.git/blobdiff - bin/whatever-dl
Use strings instead of symbols for the downloader type.
[dead/whatever-dl.git] / bin / whatever-dl
index b9ea02ca79eeab9e4690db8b49792b40d78ac48d..b3ed1ca5dc52a541e1654fee97babc7b1bc55498 100755 (executable)
@@ -59,8 +59,8 @@ opts.each do |opt, arg|
 end
 
 # Warn about nonsensical options.
-if options[:continue] and not Configuration::DOWNLOAD_METHOD == :wget
-  log.warn('The --continue flag does nothing unless DOWNLOAD_METHOD is :wget.')
+if options[:continue] and not cfg.download_method == 'wget'
+  log.warn("The --continue flag does nothing unless download_method is wget.")
 end
 
 # Note that GetoptLong steals its arguments from ARGV, so we don't need
@@ -73,6 +73,9 @@ if (ARGV.length < 1) then
   Kernel.exit(ExitCodes::EXIT_NO_URL)
 end
 
+
+cfg = Configuration.new()
+
 # Factory method.
 site = Website.create(ARGV[0])
 
@@ -92,7 +95,8 @@ end
 
 # The Downloader class is a factory; it should decide
 # which subclass we get.
-downloader = Downloader.create(Configuration::DOWNLOAD_METHOD)
+puts "download_method: #{cfg.download_method}"
+downloader = Downloader.create(cfg.download_method)
 
 # Attempt to download the file, and rescue and report
 # any (predictable) exceptions. The wget downloader will