mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
KF8 Output: Fix a couple of bugs in unused EXTH fields
This commit is contained in:
parent
f45341702f
commit
314a45ae7e
@ -144,9 +144,9 @@ class EXTHRecord(object):
|
|||||||
118 : 'retailprice',
|
118 : 'retailprice',
|
||||||
119 : 'retailpricecurrency',
|
119 : 'retailpricecurrency',
|
||||||
121 : 'KF8 header section index',
|
121 : 'KF8 header section index',
|
||||||
125 : 'KF8 resources (images/fonts) count',
|
125 : 'KF8 unknown count',
|
||||||
129 : 'KF8 cover URI',
|
129 : 'KF8 thumbnail URI',
|
||||||
131 : 'KF8 unknown count',
|
131 : 'KF8 resources (images/fonts) count',
|
||||||
201 : 'coveroffset',
|
201 : 'coveroffset',
|
||||||
202 : 'thumboffset',
|
202 : 'thumboffset',
|
||||||
203 : 'hasfakecover',
|
203 : 'hasfakecover',
|
||||||
|
@ -29,8 +29,9 @@ EXTH_CODES = {
|
|||||||
'versionnumber': 114,
|
'versionnumber': 114,
|
||||||
'startreading': 116,
|
'startreading': 116,
|
||||||
'kf8_header_index': 121,
|
'kf8_header_index': 121,
|
||||||
'num_of_resources': 125,
|
'kf8_unknown_count': 125,
|
||||||
'kf8_unknown_count': 131,
|
'kf8_thumbnail_uri': 129,
|
||||||
|
'num_of_resources': 131,
|
||||||
'coveroffset': 201,
|
'coveroffset': 201,
|
||||||
'thumboffset': 202,
|
'thumboffset': 202,
|
||||||
'hasfakecover': 203,
|
'hasfakecover': 203,
|
||||||
@ -159,7 +160,10 @@ def build_exth(metadata, prefer_author_sort=False, is_periodical=False,
|
|||||||
if thumbnail_offset is not None:
|
if thumbnail_offset is not None:
|
||||||
exth.write(pack(b'>III', EXTH_CODES['thumboffset'], 12,
|
exth.write(pack(b'>III', EXTH_CODES['thumboffset'], 12,
|
||||||
thumbnail_offset))
|
thumbnail_offset))
|
||||||
nrecs += 1
|
cover_uri_str = bytes('kindle:embed:%04X' %(thumbnail_offset))
|
||||||
|
exth.write(pack(b'>II', EXTH_CODES['kf8_cover_uri'], len(cover_uri_str) + 8))
|
||||||
|
exth.write(cover_uri_str)
|
||||||
|
nrecs += 2
|
||||||
|
|
||||||
if start_offset is not None:
|
if start_offset is not None:
|
||||||
try:
|
try:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user