X-Git-Url: http://jaekl.net/gitweb/?p=quanlib.git;a=blobdiff_plain;f=main.rb;h=4e73b07c0b490eca6eef199f504055406bfb907d;hp=76f543e61cffd9019e2a1eee49b4860e7e6ebbf4;hb=061091d1fc2bb2351afc695a5fcbdbc19e48e03b;hpb=bd862df9f2c494a890357b673a4ef26298515432 diff --git a/main.rb b/main.rb index 76f543e..4e73b07 100644 --- a/main.rb +++ b/main.rb @@ -1,10 +1,40 @@ -require './walkdir' +require 'walkdir' + +outputDir = 'output' books = [] +imageCount = 0 for arg in ARGV w = WalkDir.new(arg) - books.push(w.books) + books += (w.books) +end + +if ! Dir.exist?(outputDir) + Dir.mkdir(outputDir) +end + +open(outputDir + '/index.html', 'w') do |fd| + fd.puts "" + fd.puts " Books" + fd.puts " " + fd.puts " " + + for book in books + image = nil + if nil != book.cover + imageCount += 1 + (path, mimeType) = book.cover.writeImage(outputDir, 'image' + imageCount.to_s) + image = '' + else + image = '(No cover image)' + end + + fd.puts " " + end + + fd.puts "
" + image + "" + book.describe() + "
" + fd.puts " " + fd.puts "" end -puts books