Add `arrived` attribute (file creation timestamp) to books table.
[quanlib.git] / walkdir.rb
diff --git a/walkdir.rb b/walkdir.rb
deleted file mode 100644 (file)
index 035752f..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-# Walk the directory (and subdirectories), identifying books.
-#
-# Expected format:
-#   .../AuthorName/Title_of_the_Awesome_Book.ext
-#
-# Author is given as FirstLast.  For example, 
-# Robert Anson Heinlein is RoberHeinlein, and 
-# JKRowling is JoanneRowling.
-#
-# Book titles have spaces replaced with underscores,
-# and punctuation [,!?'] replaced with hyphens.
-#
-# If the book forms part of a series, then an all-capitals 
-# series designator, followed by a numeric volume number, 
-# followed by an underscore, is prefixed to the name.
-# For example, Hardy Boys' volume 1, The Tower Treasure, 
-# is rendered as .../FranklinDixon/HB001_The_Tower_Treasure.epub
-# and Mrs. Pollifax volume 6, On the China Station, is
-# .../DorothyGilman/P06_On_the_China_Station.epub.
-
-require 'book'
-
-class WalkDir
-  def initialize(root)
-    @root = root
-    @files = walk(@root)
-  end
-
-  def books
-    result = []
-    for file in @files.sort
-      if Book.canHandle?(file)
-        book = Book.new(file)
-        result.push(book)
-      end
-    end
-    return result
-  end
-
-  def walk(path)
-    result = []
-    children = Dir.entries(path)
-    for child in children
-      fullName = (path.chomp("/")) + "/" + child
-      if (File.directory?(fullName)) and (child != ".") and (child != "..") and (!File.symlink?(fullName))
-        sub = walk(fullName)
-        if (sub != nil) and (sub.length > 0)
-          result.concat(sub)
-        end
-      elsif (! File.directory?(fullName))
-        result.push(fullName)
-      end
-    end
-    return result
-  end
-end