From e37909f3c35b4913e3129915e460873d2cf2286f Mon Sep 17 00:00:00 2001 From: Chris Jaekl Date: Sun, 23 Jan 2022 23:23:30 -0500 Subject: [PATCH] Add `arrived` attribute (file creation timestamp) to books table. --- book.rb | 3 +++ store.rb | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/book.rb b/book.rb index ea65024..2b93f4b 100644 --- a/book.rb +++ b/book.rb @@ -12,6 +12,7 @@ class Book @@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 @@ -224,6 +225,8 @@ class Book 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 diff --git a/store.rb b/store.rb index f1b7fba..1a33ca3 100644 --- a/store.rb +++ b/store.rb @@ -71,6 +71,7 @@ EOS <