Add support for classification of non-fiction books.
[quanlib.git] / main.rb
1 require 'navigator'
2 require 'page'
3 require 'store'
4 require 'walkdir'
5
6 outputDir = 'output'
7
8 book_ids = []
9 imageCount = 0
10
11 def handleArg(arg)
12   if "--purge" == arg
13     puts 'Purging database...'
14     @store.dropSchema()
15   elsif arg.start_with?("--")
16     abort('ERROR:  Unrecognized option "' + arg + '".')
17   end
18 end
19
20 @store = Store.new()
21 @store.connect()
22
23 for arg in ARGV
24   handleArg(arg)
25 end
26
27 @store.init_db()
28
29 for arg in ARGV
30   if ! arg.start_with?("--")
31     puts 'Scanning directory "' + arg + '"...'
32     w = WalkDir.new(@store, arg)
33     book_ids += (w.books)
34   end
35 end
36
37 puts 'Creating output...'
38
39 navigator = Navigator.new(@store)
40 navigator.write_atoz_pages()
41 navigator.write_series_listing()
42 navigator.write_dewey()
43
44 @store.disconnect()
45