View Single Post
Old 02-10-2012, 09:41 AM   #1
SauliusP.
Plugin developer
SauliusP. can name that song in three notesSauliusP. can name that song in three notesSauliusP. can name that song in three notesSauliusP. can name that song in three notesSauliusP. can name that song in three notesSauliusP. can name that song in three notesSauliusP. can name that song in three notesSauliusP. can name that song in three notesSauliusP. can name that song in three notesSauliusP. can name that song in three notesSauliusP. can name that song in three notes
 
SauliusP.'s Avatar
 
Posts: 108
Karma: 24394
Join Date: Feb 2012
Location: Lithuania
Device: Kindle
Getting custom metadata field in GUI plugin

Hi all,

Recently I have started to use Calibre to transfer files to Kindle and found that APNX file is generated and books have "page numbers". However, APNX generator by John Schember is calculating page numbers in it's own algorithms.

I myself want a possibility to provide page number to the generator myself. Contacted John with few questions, but he did not want to waste his time, so simply gave me sources. I have no knowledge with Python at all, but have an idea about coding so changed his plugin so far, that I can enter desired page count for a book and generate appropriate APNX file.

Unfortunately, page count is hardcoded, so for any book I am going to read I need to change and reload the plugin. Silly way, of course.

So I want to enhance that plugin in the following way: add custom metadata field, call it "Page Count" and put page count of appropriate book into it. When I select that book and then click "Generate APNX File", plugin should read the value from that field and use it for APNX generation.

As I am unfamiliar with Calibre internals, could you please give me simple source example: what to import, how to get the metadata object for selected book(s) and how to read particular custom metadata column.

Regards,
Saulius P.
SauliusP. is offline   Reply With Quote