@@DC_NS_URL = 'http://purl.org/dc/elements/1.1/'
@@SERIES_AND_VOLUME_REGEX = /^([A-Z]+)([0-9]+(\.[0-9]+)?)$/
+ attr_accessor :arrived
attr_accessor :author
attr_accessor :classification_id
attr_accessor :cover
scan_pdf!(file_name)
end
+ @arrived = File.ctime(file_name)
+
@classification_id = @store.find_classification(@author.grouping, File.basename(file_name, '.*'))
# TODO: Fix horrible hard-coded strings and paths
<<EOS
CREATE TABLE Books (
id INTEGER PRIMARY KEY,
+ arrived TIMESTAMP,
author INTEGER REFERENCES Authors(id),
classification INTEGER REFERENCES Classifications(id),
cover INTEGER,
end
def store_book(book)
- sql = "INSERT INTO Books (id, author, classification, cover, description, language, path, series, title, volume) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10);"
+ sql = "INSERT INTO Books (id, arrived, author, classification, cover, description, language, path, series, title, volume) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11);"
book_id = next_id('book_id')
author_id = store_author(book.author)
(efs_id, mime_type) = store_cover(book)
- args = [book_id, author_id, book.classification_id, efs_id, book.description, book.language, book.path, book.series_id, book.title, book.volume]
+ args = [book_id, book.arrived, author_id, book.classification_id, efs_id, book.description, book.language, book.path, book.series_id, book.title, book.volume]
begin
rs = @conn.exec_params(sql, args)