X-Git-Url: http://jaekl.net/gitweb/?p=quanlib.git;a=blobdiff_plain;f=book.rb;h=a94e33cfcffdc34ecbba6876b07e30c5c5d00bd3;hp=b0a1bbff66de2851b9bab47b8ad6eb0d16cc65f3;hb=0aeb88ddc91aa8f9fd8d93a8004d5df5094a4613;hpb=b8fe580f73b094e366643388ecd2d184b643616a diff --git a/book.rb b/book.rb index b0a1bbf..a94e33c 100644 --- a/book.rb +++ b/book.rb @@ -240,6 +240,9 @@ class Book 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 @@ -249,6 +252,9 @@ class Book @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") @@ -258,6 +264,13 @@ class Book 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