5 def initialize(fileName)
12 parseFileName!(fileName)
15 def self.canHandle?(fileName)
20 lowerName = fileName.downcase()
22 if lowerName.end_with?(".epub")
32 data.push('series="' + @series + '"')
35 data.push('volume="' + @volume + '"')
38 data.push('title="' + @title + '"')
41 data.push('author="' + @author + '"')
43 return '(Book:' + data.join(',') + ')'
52 return /[[:upper:]]/.match(c)
56 def massageAuthor(input)
62 input.each_char do |c|
63 if isUpper?(c) and (result.length > 0)
72 # Returns (series, volumeNo, titleText)
74 def processTitle(input)
79 arr = input.split('_')
85 matchData = (arr[0]).match(/^([A-Z]+)([0-9]+)$/)
87 capt = matchData.captures
93 pos = arr[-1].rindex('.')
95 arr[-1] = arr[-1].slice(0, pos)
100 return series, vol, title
104 def parseFileName!(fileName)
105 parts = fileName.split('/')
106 (@series, @volume, @title) = processTitle(parts[-1])
108 @author = massageAuthor(parts[-2])