View Single Post
Old 06-02-2017, 08:49 AM   #2511
penguintri
Enthusiast
penguintri began at the beginning.
 
Posts: 30
Karma: 10
Join Date: Apr 2010
Device: Paperwhite 2
Quote:
Originally Posted by nemiere View Post
Last version of this excellent ScreenSavers hack fail to extract a cover from some ebooks in a "new slight variation" of kfx format developed by Amazon from last January.

While waiting for a proper fix by masters @NiLuJe or @jhowell, you can try this quick and dirty patch to file
Code:
src/linkss/bin/kfxmeta.py
:

Code:
$ diff kfxmeta-orig.py kfxmeta.py
264c264,267
<             for value1 in entity_value[b"categorised_metadata"]:
---
>             target = entity_value
>             if entity_value.has_key("type") and entity_value["type"] == b"P2":
>                 target = entity_value["value"]
>             for value1 in target[b"categorised_metadata"]:
It works for all my kfx amazon ebooks ("old" and "new" variations).
Thanks for this. Some simple ish instructions on how to apply this would be greatly appreciated. Unfortunately I don't know python at all.

I've opened src/linkss/bin/kfxmeta.py in word pad and fond the below section, however from your post I'm not sure what exactly to change.


Code:
    for entity in container_data:
        entity_type = entity["type"]
        entity_value = entity["value"]

        if entity_type == b"metadata":
            for key,value in entity_value.items():
                if key in SYMBOL_TABLE.values():
                    add_metadata(key, value)

        elif entity_type == b"book_metadata":
            for value1 in entity_value[b"categorised_metadata"]:
                for meta in value1[b"metadata"]:
                    add_metadata(meta[b"key"], meta[b"value"])

        elif entity_type == b"bcRawMedia" and entity_type not in metadata:
            metadata[entity_type] = entity_value    # assume first image is the cover

    return metadata
penguintri is offline   Reply With Quote