Improve handling of KFX metadata

This commit is contained in:
j-howell 2019-04-17 11:16:05 -04:00
parent a5aec9233f
commit b99645bbbc

View File

@ -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