input.each_char do |c|
if isUpper?(c) and (reading_order.length > 0)
reading_order += " "
- end
+ end
reading_order += c
end
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]
protected
def load_cover(zipfile, opfPath, opfDoc, coverId)
- coverFile = nil
if nil == coverId
coverId = "cover-image"
end
# 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
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]
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