require 'store'
require 'walkdir'
-outputDir = 'output'
+@outputDir = 'output'
book_ids = []
-imageCount = 0
+@config_file = 'quanlib.ini'
+@skip_class = false
def handleArg(arg)
- if "--purge" == arg
+ if arg.start_with?("--config=")
+ @config_file = arg[9..-1]
+ puts 'Using config file "' + @config_file + '".'
+ elsif "--purge" == arg
puts 'Purging database...'
@store.dropSchema()
- if File.exists?(Store.unclassified_csv)
- File.delete(Store.unclassified_csv)
+ if File.exists?(@store.unclassified_csv)
+ File.delete(@store.unclassified_csv)
end
+ elsif "--skip-class" == arg
+ puts 'Skipping load of classification table.'
+ @skip_class = true
elsif arg.start_with?("--")
abort('ERROR: Unrecognized option "' + arg + '".')
end
end
-@store = Store.new()
+@store = Store.new(@config_file)
@store.connect()
for arg in ARGV
handleArg(arg)
end
-@store.init_db()
+@store.init_db(@skip_class)
for arg in ARGV
if ! arg.start_with?("--")