Quote:
Originally Posted by xxyzz
I tried to edit ASIN of KFX book by doing this, but nothing happened, is this the right way?
Code:
from calibre_plugins.kfx_input.kfxlib import YJ_Book
book = YJ_Book('book.kfx')
metadata = book.get_metadata()
metadata.asin = 'BBBBB'
book.set_yj_metadata_to_book(metadata)
|
set_yj_metadata_to_book is an internal function, not meant to be called directly. You should do something like this instead:
Code:
book = YJ_Book("book.kfx")
md = YJ_Metadata()
md.asin = "B000000000"
md.cde_content_type = "EBOK"
book.decode_book(set_metadata=md)
new_kfx_data = book.convert_to_single_kfx()
with io.open("new_book.kfx", "wb") as new_file:
new_file.write(new_kfx_data)
Also see "metadata_writer.py" in the KFX Output plugin for an example of how to set metadata to KFX format.
Quote:
Originally Posted by xxyzz
I think the 116 line of yj_metabata.py should be:
Code:
if yj_metadata.asin is None:
|
That line is coded as I intended. A value of "True" as a special flag indicating that a random ASIN should be generated. A value of "None" means do not change the ASIN.
Quote:
Originally Posted by xxyzz
And I wonder why it's call yj_book, is this some abbreviation?
|
"YJ" is short for "Yellow Jersey" the Amazon code name for KFX format and related technology.
Quote:
Originally Posted by xxyzz
|
SRL is the start reading location, the position where a new book should open for the first time. ERL is the end reading location, the position at which the "before you go" popup screen should occur when reading. They mark the boundaries of the main content of the book.