Adds support for tracking series and generating pages based on them.
[quanlib.git] / walkdir.rb
index 035752f05d48785d10db87d3b6e6bf91abe855a2..1dadd2e35b95974f81ad43366698c46b93dac7b9 100644 (file)
 # .../DorothyGilman/P06_On_the_China_Station.epub.
 
 require 'book'
+require 'store'
 
 class WalkDir
-  def initialize(root)
+  def initialize(store, root)
     @root = root
+    @store = store
     @files = walk(@root)
   end
 
@@ -30,8 +32,10 @@ class WalkDir
     result = []
     for file in @files.sort
       if Book.canHandle?(file)
-        book = Book.new(file)
-        result.push(book)
+        book = Book.new(@store)
+        book.loadFromFile(file)
+        id = @store.store_book(book)
+        result.push(id)
       end
     end
     return result
@@ -51,6 +55,7 @@ class WalkDir
         result.push(fullName)
       end
     end
+    #puts result
     return result
   end
 end