X-Git-Url: http://jaekl.net/gitweb/?p=quanlib.git;a=blobdiff_plain;f=main.rb;h=b0c4b795c714410162fc23c0953601b0fce12ab8;hp=e1a52053b93f5c8c107d9178731d1169cfbd7388;hb=5c1cd0b8778c301090bfdda6f9cb2399e70b792d;hpb=dfbc8c62ee2ee6e188609fc44e1a5ac4df40acf4 diff --git a/main.rb b/main.rb index e1a5205..b0c4b79 100644 --- a/main.rb +++ b/main.rb @@ -1,30 +1,40 @@ -require 'navigator' -require 'page' -require 'store' -require 'walkdir' +require_relative 'navigator' +require_relative 'page' +require_relative 'store' +require_relative '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) + 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?("--") @@ -34,11 +44,14 @@ for arg in ARGV end end +@store.cross_reference_lists + puts 'Creating output...' navigator = Navigator.new(@store) navigator.write_atoz_pages() navigator.write_series_listing() +navigator.write_dewey() @store.disconnect()