Forgot another use of container.bookmark_data

This commit is contained in:
Kovid Goyal 2019-10-26 14:27:45 +05:30
parent 2d2ee3f85c
commit e3adac0c51
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -802,8 +802,8 @@ def parse_annotations(raw):
yield parse_annotation(annot) yield parse_annotation(annot)
def get_stored_annotations(container): def get_stored_annotations(container, bookmark_data):
raw = container.bookmark_data or b'' raw = bookmark_data or b''
if not raw: if not raw:
return return
if raw.startswith(EPUB_FILE_TYPE_MAGIC): if raw.startswith(EPUB_FILE_TYPE_MAGIC):
@ -848,7 +848,7 @@ def render(pathtoebook, output_dir, book_hash=None, serialize_metadata=False, ex
if extract_annotations: if extract_annotations:
annotations = None annotations = None
if bookmark_data: if bookmark_data:
annotations = json_dumps(tuple(get_stored_annotations(container))) annotations = json_dumps(tuple(get_stored_annotations(container, bookmark_data)))
if annotations: if annotations:
with lopen(os.path.join(output_dir, 'calibre-book-annotations.json'), 'wb') as f: with lopen(os.path.join(output_dir, 'calibre-book-annotations.json'), 'wb') as f:
f.write(annotations) f.write(annotations)