Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Readers > Amazon Kindle > Kindle Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 03-09-2021, 07:48 PM   #1
xxyzz
Evangelist
xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.
 
Posts: 419
Karma: 2666666
Join Date: Nov 2020
Device: none
Question about word wise

Does anyone know what sidecarRevision, bookRevision and sidecarFormat from metadata table(https://github.com/xxyzz/WordDumb/bl...layerenasinkll) are used for? And how to get these values for a certain book?

I find out how to get acr for mobi and azw3 books but don't know where to find it in kfx books.
xxyzz is offline   Reply With Quote
Old 03-09-2021, 10:06 PM   #2
jhowell
Grand Sorcerer
jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.
 
jhowell's Avatar
 
Posts: 6,561
Karma: 84810789
Join Date: Nov 2011
Location: Tampa Bay, Florida
Device: Kindles
Quote:
Originally Posted by xxyzz View Post
Does anyone know what sidecarRevision, bookRevision and sidecarFormat from metadata table(https://github.com/xxyzz/WordDumb/bl...layerenasinkll) are used for? And how to get these values for a certain book?
I don't know about the others, but bookRevision looks like the number that is changed each time a book is revised. it is called "Unique-ID" in the MobileRead wiki documentation of the MOBI header.

Quote:
Originally Posted by xxyzz View Post
I find out how to get acr for mobi and azw3 books but don't know where to find it in kfx books.
The acr field corresponds to the "asset_id" contained in KFX book metadata. It is basically a unique file name assigned to the main file of the book in the KFX format.

One way to obtain this is to use the KFX Input calibre plugin in CLI mode. The console output from that will contain a string in the form "asset_id=CR!9PSZZDRCQX6DQDZPFDT3G8FMCE39," giving you the value.
jhowell is offline   Reply With Quote
Advert
Old 03-10-2021, 02:15 AM   #3
xxyzz
Evangelist
xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.
 
Posts: 419
Karma: 2666666
Join Date: Nov 2020
Device: none
Thanks!

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)
I think the 116 line of yj_metabata.py should be:
Code:
if yj_metadata.asin is None:
And I wonder why it's call yj_book, is this some abbreviation?

I forget to ask about srl and erl in book_metadata table: https://github.com/xxyzz/WordDumb/bl...ntitiesasinasc

Last edited by xxyzz; 03-10-2021 at 03:21 AM.
xxyzz is offline   Reply With Quote
Old 03-10-2021, 10:31 AM   #4
jhowell
Grand Sorcerer
jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.
 
jhowell's Avatar
 
Posts: 6,561
Karma: 84810789
Join Date: Nov 2011
Location: Tampa Bay, Florida
Device: Kindles
Quote:
Originally Posted by xxyzz View Post
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 View Post
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 View Post
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 View Post
I forget to ask about srl and erl in book_metadata table: https://github.com/xxyzz/WordDumb/bl...ntitiesasinasc
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.
jhowell is offline   Reply With Quote
Old 03-10-2021, 11:50 AM   #5
NiLuJe
BLAM!
NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.
 
NiLuJe's Avatar
 
Posts: 13,482
Karma: 26012494
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
Wasn't it Yellow Jacket (like the wasps, I assume, because it's tiny, angry and fast? ^^)?

(Not that it changes much in the grand scheme of things, and it's been entirely too long since I've looked at any of this stuff ^^).
NiLuJe is offline   Reply With Quote
Advert
Old 03-10-2021, 01:13 PM   #6
jhowell
Grand Sorcerer
jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.
 
jhowell's Avatar
 
Posts: 6,561
Karma: 84810789
Join Date: Nov 2011
Location: Tampa Bay, Florida
Device: Kindles
Quote:
Originally Posted by NiLuJe View Post
Wasn't it Yellow Jacket (like the wasps, I assume, because it's tiny, angry and fast? ^^)?
It's definitely yellow jersey. Apparently someone at Amazon is a cycling fan.

The YJ renderer version number in Kindle firmware can be found in the file: /usr/share/yellowjersey/version.txt
jhowell is offline   Reply With Quote
Old 03-10-2021, 01:15 PM   #7
NiLuJe
BLAM!
NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.
 
NiLuJe's Avatar
 
Posts: 13,482
Karma: 26012494
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
Ah, thanks . As a non-native speaker, the Jersey/Jacket distinction was never my forte (and for some reason the wasp thing stuck with me way back when KFX was originally introduced ^^) .
NiLuJe is offline   Reply With Quote
Old 03-10-2021, 10:16 PM   #8
xxyzz
Evangelist
xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.
 
Posts: 419
Karma: 2666666
Join Date: Nov 2020
Device: none
Thanks for the help!

I still have some questions:

- I'm using the following code to get acr:

Code:
book = YJ_Book(book_path)
book.get_metadata()
return book.get_asset_id()
Do I need to call 'book.final_actions() to clear temp files?

- Why 'convert_to_single_kfx' calls 'decode_book' again?

- Should I just use the first and the last test location as srl and erl or get them from header or somewhere?

- I'm using regex('>[^<>]+<') to find the text between tags for MOBI and AZW3 books, it there a better way(faster and skip tags like <style>) to get the book text and their locations?

- I guess kfx doesn't have a header similar to Unique-ID?

- How do you know all these stuffs about Kindle?
xxyzz is offline   Reply With Quote
Old 03-11-2021, 10:54 AM   #9
jhowell
Grand Sorcerer
jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.
 
jhowell's Avatar
 
Posts: 6,561
Karma: 84810789
Join Date: Nov 2011
Location: Tampa Bay, Florida
Device: Kindles
Quote:
Originally Posted by xxyzz View Post
I'm using the following code to get acr:

Code:
book = YJ_Book(book_path)
book.get_metadata()
return book.get_asset_id()
That looks like that will work.

In the future I will include the asset_id as part of the YJ_Metadata object returned by get_metadata to avoid the need to call get_asset_id. I did not intend for get_asset_id to be used by external software.

Quote:
Originally Posted by xxyzz View Post
Do I need to call 'book.final_actions() to clear temp files?
It should not be necessary. I will look at the code and if it is needed I will do it inside of get_metadata.

Quote:
Originally Posted by xxyzz View Post
Why 'convert_to_single_kfx' calls 'decode_book' again?
Just in case it has not been called previously. decode_book will do nothing if it is called more than once.

Quote:
Originally Posted by xxyzz View Post
Should I just use the first and the last test location as srl and erl or get them from header or somewhere?
I don't know why the XRAY file contains those fields. You may need to experiment to find out what values will work.

Quote:
Originally Posted by xxyzz View Post
I'm using regex('>[^<>]+<') to find the text between tags for MOBI and AZW3 books, it there a better way(faster and skip tags like <style>) to get the book text and their locations?
A regex sounds like a good idea to me. Perhaps someone else will have another suggestion.

Quote:
Originally Posted by xxyzz View Post
I guess kfx doesn't have a header similar to Unique-ID?
That is correct. That field does not occur in KFX format.

Quote:
Originally Posted by xxyzz View Post
How do you know all these stuffs about Kindle?
Online research and looking at what code I can find.
jhowell is offline   Reply With Quote
Old 03-11-2021, 07:17 PM   #10
xxyzz
Evangelist
xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.
 
Posts: 419
Karma: 2666666
Join Date: Nov 2020
Device: none
Thanks for your patience. All of these values seem to have no effect on word wise and x-ray but I think it's better to use the correct values if I can.
xxyzz is offline   Reply With Quote
Old 03-12-2021, 01:29 AM   #11
AmirHXe
Member
AmirHXe began at the beginning.
 
Posts: 19
Karma: 10
Join Date: Apr 2018
Device: none
Quote:
Originally Posted by xxyzz View Post
Thanks for your patience. All of these values seem to have no effect on word wise and x-ray but I think it's better to use the correct values if I can.
Maybe it affects android?
AmirHXe is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Troubleshooting Question about "Word Wise" Kindle app android sprazer Amazon Kindle 1 08-22-2018 04:02 AM
Word Wise for custom ebooks? Entry20 Kindle Formats 1 03-12-2018 10:53 AM
Word Wise not working properly? doctorat Amazon Kindle 3 08-23-2017 03:43 AM
Content Word wise in converted files anshulgaba Amazon Kindle 1 11-25-2016 04:57 AM
New Kindle Word Wise feature Doitsu Kindle Formats 38 07-20-2015 06:40 AM


All times are GMT -4. The time now is 04:22 AM.


MobileRead.com is a privately owned, operated and funded community.