Hi DiapDealer,
I wonder if the new layout has multiple huffdic dictionaries (different for each mobi header in the .mobi). If so, we might need to offset the huffdic section number by the self.start since it could be relative to the specific mobi header and not the same one used for both rawmls.
I will add the exception code back to the mobi_uncompress as well.
Thanks!
Kevin
Code:
if compression == 0x4448:
print "Huffdic compression"
reader = HuffcdicReader()
huffoff, huffnum = struct.unpack_from('>LL', self.header, 0x70)
# need to add this line
huffoff = huffoff + self.start
reader.loadHuff(self.sect.loadSection(huffoff))
for i in xrange(1, huffnum):
reader.loadCdic(self.sect.loadSection(huffoff+i))
self.unpack = reader.unpack
Quote:
Originally Posted by DiapDealer
I'm getting errors unpacking a KF8/MOBI I built with Huffdic compression using the new Kindlegen 2.3(36043). I'm using the most recent mobi_unpack ( from this post).
Code:
MobiUnpack 0.33
Copyright (c) 2009 Charles M. Hannum <root@ihack.net>
With Additions by P. Durrant, K. Hendricks, S. Siebert, fandrieu and DiapDealer.
Unpacking Book...
Palm DB type: BOOKMOBI
Mobi Version: 6
Codec: utf-8
Title: Shahnameh
Huffdic compression
Mobi Ebook uses the new K8 file format
Mobi Version: 8
Codec: utf-8
Title: Shahnameh
Huffdic compression
Traceback (most recent call last):
File "mobi_unpack.py", line 864, in <module>
sys.exit(main())
File "mobi_unpack.py", line 855, in main
unpackBook(infile, outdir)
File "mobi_unpack.py", line 559, in unpackBook
mh = MobiHeader(sect,i+1)
File "mobi_unpack.py", line 222, in __init__
reader.loadHuff(self.sect.loadSection(huffoff))
File "C:\Users\***\Downloads\mobi_unpack_update\mobi_uncompress.py", line 42, in loadHuff
raise unpackException('invalid huff header')
NameError: global name 'unpackException' is not defined
Besides the fact that the unpackException class doesn't exist for error handling... mobi_unpack appears to think the huff header is invalid. The mobi otherwise performs as expected with Kindle previewer (simulating Kindle Fire) and a standalone Kindle 2.
That's the second time through on the KF8 MobiHeader parse, when trying to build the Huffdic reader for the KF8 portions. It looks like the huff header for the KF8 portions is either different or in a different location.
I'm looking, but I thought I'd let someone else know as well.
|