diff --git a/src/calibre/ebooks/mobi/debug/headers.py b/src/calibre/ebooks/mobi/debug/headers.py index 5b80a46f1b..2b5d6920a5 100644 --- a/src/calibre/ebooks/mobi/debug/headers.py +++ b/src/calibre/ebooks/mobi/debug/headers.py @@ -144,9 +144,9 @@ class EXTHRecord(object): 118 : 'retailprice', 119 : 'retailpricecurrency', 121 : 'KF8 header section index', - 125 : 'KF8 resources (images/fonts) count', - 129 : 'KF8 cover URI', - 131 : 'KF8 unknown count', + 125 : 'KF8 unknown count', + 129 : 'KF8 thumbnail URI', + 131 : 'KF8 resources (images/fonts) count', 201 : 'coveroffset', 202 : 'thumboffset', 203 : 'hasfakecover', diff --git a/src/calibre/ebooks/mobi/writer8/exth.py b/src/calibre/ebooks/mobi/writer8/exth.py index 508b77ce5b..603767b3d7 100644 --- a/src/calibre/ebooks/mobi/writer8/exth.py +++ b/src/calibre/ebooks/mobi/writer8/exth.py @@ -29,8 +29,9 @@ EXTH_CODES = { 'versionnumber': 114, 'startreading': 116, 'kf8_header_index': 121, - 'num_of_resources': 125, - 'kf8_unknown_count': 131, + 'kf8_unknown_count': 125, + 'kf8_thumbnail_uri': 129, + 'num_of_resources': 131, 'coveroffset': 201, 'thumboffset': 202, 'hasfakecover': 203, @@ -159,7 +160,10 @@ def build_exth(metadata, prefer_author_sort=False, is_periodical=False, if thumbnail_offset is not None: exth.write(pack(b'>III', EXTH_CODES['thumboffset'], 12, 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: try: