projects
/
quanlib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Improves handling of non-fiction classification data.
[quanlib.git]
/
book.rb
diff --git
a/book.rb
b/book.rb
index b0a1bbff66de2851b9bab47b8ad6eb0d16cc65f3..a94e33cfcffdc34ecbba6876b07e30c5c5d00bd3 100644
(file)
--- a/
book.rb
+++ b/
book.rb
@@
-240,6
+240,9
@@
class Book
protected
def parse_file_name!(file_name)
protected
def parse_file_name!(file_name)
+ category = nil # e.g., non-fiction, fan-fiction
+ grouping = ''
+
parts = file_name.split('/')
(series_code, @volume, @title) = processTitle(parts[-1])
if parts.length > 1
parts = file_name.split('/')
(series_code, @volume, @title) = processTitle(parts[-1])
if parts.length > 1
@@
-249,6
+252,9
@@
class Book
@author = Author.new(grouping, reading_order, sort_order)
@series_id = @store.get_series(grouping, series_code)
end
@author = Author.new(grouping, reading_order, sort_order)
@series_id = @store.get_series(grouping, series_code)
end
+ if parts.length > 2
+ category = parts[-3]
+ end
lc_file_name = file_name.downcase
if lc_file_name.end_with?(".epub")
lc_file_name = file_name.downcase
if lc_file_name.end_with?(".epub")
@@
-258,6
+264,13
@@
class Book
end
@classification_id = @store.find_classification(@author.grouping, File.basename(file_name, '.*'))
end
@classification_id = @store.find_classification(@author.grouping, File.basename(file_name, '.*'))
+
+ # TODO: Fix horrible hard-coded strings and paths
+ if ('01_nonfic' == category) && (nil == classification_id)
+ open(Store.unclassified_csv, 'a') do |fd|
+ fd.puts('"' + grouping.to_s + '","' + path + '"')
+ end
+ end
end
protected
end
protected