Using the latest to unpack a KF8 generated by kindlegen from an OEB generated by calibre, I get a trap in mobi_k8proc.py/K8processor
Code:
# read / process other index, looks like a partial <guide> of <toc> but not too sure.
# Not being used yet
othtbl = []
if self.othidx != 0xffffffff:
outtbl, ctoc_text = self.mi.getIndexData(self.othidx)
for [text, tagMap] in outtbl:
# text, ctoc text, file num
ctocoffset = tagMap[1][0]
ctocdata = ctoc_text[ctocoffset]
othtbl.append([text, ctocdata, tagMap[6][0]])
self.othtbl = othtbl
That tagMap doesn't have a key 6. Upon investigation it looks like the tagMap key is 3 as in
Code:
# read / process other index, looks like a partial <guide> of <toc> but not too sure.
# Not being used yet
# KF8: tagMap[6] key error, think it's tagMap[3]
othtbl = []
if self.othidx != 0xffffffff:
outtbl, ctoc_text = self.mi.getIndexData(self.othidx)
for [text, tagMap] in outtbl:
# text, ctoc text, file num
ctocoffset = tagMap[1][0]
ctocdata = ctoc_text[ctocoffset]
othtbl.append([text, ctocdata, tagMap[3][0]])
## othtbl.append([text, ctocdata, tagMap[6][0]])
self.othtbl = othtbl
which works because the info in question is the masthead coordinates. Following is the console output from the corrected code
Code:
0 Masthead Image
name length is 9
15 image/jpg
IndexCount is 1
TagTable: [(1, 1, 1, 0), (2, 1, 2, 0), (3, 1, 4, 0), (0, 0, 0, 1)]
parsed INDX header:
len C0 nul1 0 type 1 gen 0 start D0 count 1 code FFFFFFFF lng FFFFFFFF total 0 ordt 0 ligt 0 nligt 0 nctoc 0
208 1
>>tagMap
{1: [0], 2: [1], 3: [15]}
masthead
other table: text_type, ctoc data, file number
[['masthead', 'Masthead Image', 15]]
I added the >>tagMap dump investigating this.