View Single Post
Old 02-10-2012, 01:05 PM   #5
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
Hi, thank you for quick response.

Kiwidude, if you could take that plugin (and APNXBuilder itself, which works when MOBI is sent to Kindle) and add the functionality of taking page count from custom metadata column, that would be tremendous. I would simple spend two or three months on that and don't think it is worth it.

So far, some "hacking" I've already done and will attach what I've got.

I have implemented, as I've said, quick and dirty solution, with hard-coded page count. I have also copied the source of APNXBuilder into plugin's source file, as it is the "file type" kiwidude mentioned and I had to add one more method to it, which would accept page count as an argument. That method I've called get_pages_exact. So APNXBuilder, before calling this method, should also take page count from some user-defined column. You'll find two places in the code, where that method is called, with hardcoded value of 349 (last book I have planned to read has this count of pages).

Attached are:
plugin_apnx_generator-1.1.0.zip: John's original plugin.
apnx-generator-exact.zip: my "quick'n'dirty" solution. However, I think, that get_pages_exact is quite in acceptable shape to be put into official source.

As a workflow, I would imagine this:
1. MOBI file is sent to Kindle.
2. APNXBuilder is called to create APNX file (as it is now, too)
3. Default action: try to read page count from user-defined column, probably, default name "Page Count".
4. If "Page Count" reading fails (0 or null value or column not created by user), try get_pages_accurate (Default method by John).
5. If accurate fails, call get_pages_fast.

All above three methods do not write anything, just generate an array of locations in MOBI file. Array member count matches that of the pages.

As additional functionality for GUI plugin, there might be even another action, i.e. possibility to enter page count via dialogue, in case custom column is not defined, but you just want to do it right away.

Regards,
Saulius P.
Attached Files
File Type: zip plugin_apnx_generator-1.1.0.zip (13.8 KB, 459 views)
File Type: zip apnx-generator-exact.zip (12.9 KB, 466 views)
SauliusP. is offline   Reply With Quote