mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
9712175d74
commit
dd20e427b5
@ -186,6 +186,8 @@ class BookHeader(object):
|
|||||||
if len(raw) >= 0xF8:
|
if len(raw) >= 0xF8:
|
||||||
self.ncxidx, = struct.unpack_from(b'>L', raw, 0xF4)
|
self.ncxidx, = struct.unpack_from(b'>L', raw, 0xF4)
|
||||||
|
|
||||||
|
# Ancient PRC files from Baen can have random values for
|
||||||
|
# mobi_version, so be conservative
|
||||||
if self.mobi_version == 8 and len(raw) >= (0xF8 + 16):
|
if self.mobi_version == 8 and len(raw) >= (0xF8 + 16):
|
||||||
self.dividx, self.skelidx, self.datpidx, self.othidx = \
|
self.dividx, self.skelidx, self.datpidx, self.othidx = \
|
||||||
struct.unpack_from(b'>4L', raw, 0xF8)
|
struct.unpack_from(b'>4L', raw, 0xF8)
|
||||||
|
@ -107,7 +107,10 @@ class MobiReader(object):
|
|||||||
self.kf8_type = None
|
self.kf8_type = None
|
||||||
k8i = getattr(self.book_header.exth, 'kf8_header', None)
|
k8i = getattr(self.book_header.exth, 'kf8_header', None)
|
||||||
|
|
||||||
if self.book_header.mobi_version == 8:
|
# Ancient PRC files from Baen can have random values for
|
||||||
|
# mobi_version, so be conservative
|
||||||
|
if (self.book_header.mobi_version == 8 and hasattr(self.book_header,
|
||||||
|
'skelidx')):
|
||||||
self.kf8_type = 'standalone'
|
self.kf8_type = 'standalone'
|
||||||
elif k8i is not None: # Check for joint mobi 6 and kf 8 file
|
elif k8i is not None: # Check for joint mobi 6 and kf 8 file
|
||||||
try:
|
try:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user