From b99645bbbc78e971569177900c46b39add2b4550 Mon Sep 17 00:00:00 2001 From: j-howell Date: Wed, 17 Apr 2019 11:16:05 -0400 Subject: [PATCH] Improve handling of KFX metadata --- src/calibre/ebooks/metadata/kfx.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/calibre/ebooks/metadata/kfx.py b/src/calibre/ebooks/metadata/kfx.py index 0b662346d6..fba2518575 100644 --- a/src/calibre/ebooks/metadata/kfx.py +++ b/src/calibre/ebooks/metadata/kfx.py @@ -254,11 +254,11 @@ def extract_metadata(container_data): # locate book metadata within the container data structures + metadata_entity = {} + for entity_type, entity_id, entity_value in container_data: if entity_type == PROP_METADATA: - for key, value in entity_value.items(): - if key in METADATA_PROPERTIES: - metadata[METADATA_PROPERTIES[key]].append(value) + metadata_entity = entity_value elif entity_type == PROP_METADATA2: if entity_value is not None: @@ -270,6 +270,10 @@ def extract_metadata(container_data): # assume first image is the cover metadata[COVER_KEY] = entity_value + for key, value in metadata_entity.items(): + if key in METADATA_PROPERTIES: + metadata[METADATA_PROPERTIES[key]].append(value) + return metadata