From: Chris Jaekl Date: Thu, 20 Jun 2024 15:45:02 +0000 (-0400) Subject: Clean up indendation and unused variables X-Git-Url: http://jaekl.net/gitweb/?a=commitdiff_plain;h=e8d34a5640c350c11de6c68cee80746bb042d3b7;p=quanlib.git Clean up indendation and unused variables --- diff --git a/app/book.rb b/app/book.rb index 2b93f4b..8c41067 100644 --- a/app/book.rb +++ b/app/book.rb @@ -153,7 +153,7 @@ class Book input.each_char do |c| if isUpper?(c) and (reading_order.length > 0) reading_order += " " - end + end reading_order += c end @@ -173,7 +173,7 @@ class Book vol = nil first = arr[0] - matchData = (arr[0]).match(@@SERIES_AND_VOLUME_REGEX) + matchData = (first).match(@@SERIES_AND_VOLUME_REGEX) if nil != matchData capt = matchData.captures series = capt[0] @@ -372,7 +372,6 @@ class Book protected def load_cover(zipfile, opfPath, opfDoc, coverId) - coverFile = nil if nil == coverId coverId = "cover-image" end @@ -392,7 +391,7 @@ class Book # wild have been found to use a bath relative to the location # of the opf file. parts = opfPath.split('/') - opfBasePath = opfPath.split('/')[0..-2].join('/') + opfBasePath = parts[0..-2].join('/') coverPath = opfBasePath + '/' + href entry = zipfile.find_entry(coverPath) end diff --git a/app/store.rb b/app/store.rb index 1a33ca3..843d01b 100644 --- a/app/store.rb +++ b/app/store.rb @@ -327,7 +327,7 @@ EOS book_id = next_id('book_id') author_id = store_author(book.author) - (efs_id, mime_type) = store_cover(book) + efs_id = store_cover(book)&.first 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] @@ -420,7 +420,7 @@ EOS FileUtils.mkdir_p(efspath) - (filepath, mimetype) = cover.write_image(efspath, efsname) + mimetype = cover.write_image(efspath, efsname)&.last sql = "INSERT INTO efs VALUES ($1, $2)" begin