X-Git-Url: http://jaekl.net/gitweb/?p=quanlib.git;a=blobdiff_plain;f=main.rb;h=d193c22360fab18aa2850cbc5a2b6d132c2aa843;hp=596e11ff526fec0f09227bda8bcad927ab163180;hb=b31122c5ed23e2e77b527c0979b6355e9e3dda1f;hpb=4b53af822cda819dd82d0d3e7ed066c2966ae4bf diff --git a/main.rb b/main.rb index 596e11f..d193c22 100644 --- a/main.rb +++ b/main.rb @@ -1,9 +1,10 @@ +require 'page' require 'store' require 'walkdir' outputDir = 'output' -books = [] +book_ids = [] imageCount = 0 def handleArg(arg) @@ -28,65 +29,41 @@ for arg in ARGV if ! arg.start_with?("--") puts 'Scanning directory "' + arg + '"...' w = WalkDir.new(@store, arg) - books += (w.books) + book_ids += (w.books) end end puts 'Creating output...' -if ! Dir.exist?(outputDir) - Dir.mkdir(outputDir) -end - -open(outputDir + '/index.html', 'w') do |fd| - fd.puts '' - fd.puts '
' - fd.puts ' ' - fd.puts '' + image + ' | ' +('A'..'Z').each do |letter| + book_ids = @store.query_books_by_author(letter + '%') + puts 'Authors starting with "' + letter + '": ' + book_ids.length.to_s() + ' books.' + counts[letter] = book_ids.length - heading = book.heading() - description = book.description() - if nil != description - fd.puts '' + heading + ' ' + heading + ' ' + description + ' | ' + heading + ' | ' - end - - fd.puts '
Author | Books |
---|---|
Starting with ' + letter + ' | ' + counts[letter].to_s + ' |