projects
/
quanlib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add `arrived` attribute (file creation timestamp) to books table.
[quanlib.git]
/
main.rb
diff --git
a/main.rb
b/main.rb
index 6e7a44184ff4b94357e960ef6e5f4c3d6b07a4d1..e294b4a15e3391a0e4b84d41235b2eee1265ca31 100644
(file)
--- a/
main.rb
+++ b/
main.rb
@@
-1,39
+1,50
@@
-require 'navigator'
-require 'page'
-require 'store'
-require
'walk
dir'
+require
_relative
'navigator'
+require
_relative
'page'
+require
_relative
'store'
+require
_relative 'walk_
dir'
-outputDir = 'output'
+
@
outputDir = 'output'
-book_ids = []
-imageCount = 0
+@config_file = 'quanlib.ini'
+@skip_class = false
def handleArg(arg)
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()
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
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.connect()
for arg in ARGV
handleArg(arg)
end
-@store.init_db()
+@store.init_db(
@skip_class
)
for arg in ARGV
if ! arg.start_with?("--")
puts 'Scanning directory "' + arg + '"...'
for arg in ARGV
if ! arg.start_with?("--")
puts 'Scanning directory "' + arg + '"...'
- w = WalkDir.new(@
stor
e, arg)
- book_ids += (w.books)
+ w = WalkDir.new(@
config_fil
e, arg)
+ w.books
end
end
end
end
+@store.cross_reference_lists
+
puts 'Creating output...'
navigator = Navigator.new(@store)
puts 'Creating output...'
navigator = Navigator.new(@store)