View Single Post
Old 11-06-2011, 12:34 PM   #156
kiwidude
Calibre Plugins Developer
kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.
 
Posts: 4,637
Karma: 2162064
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
@Nyssa - PM me a link to a couple of those files so I can confirm what is going on. At a guess without seeing them I would say it is because of the following...

For counting pages in MOBI files, the plugin uses the Calibre code (the same code used when you send a MOBi file to your kindle and get it to generate an APNX file). This algorithm is based on counting the number of <p> paragraph tags.

However some books have the bulk of their content based on <div> tags instead. For ePub based page counting, I have an additional check which compares the number of div tags with the number of p tags - whichever is greater it uses as the basis for the count. This should give a more accurate count for div based books.

Note that logic only exists for epub books - for those files you are having problems with, try a conversion to ePub, make sure the plugin is configured to "prefer" the ePub version and see what count it comes up with.

Arguably the Calibre mobi page counting logic should be improved to try the same technique of comparing div with p tags and using whichever is bigger. However I leave that to user_none if he considers that desirable.

In a future version of this plugin as mentioned above I think I am going to *only* support counting pages based on the plugin doing a temporary conversion to ePub, so it uses my "tweaked" algorithms for estimations. This would also mean that a page count could be determined for books which you dont have/want to convert ePub or MOBi formats for, such as FB2 as mentioned above. However it would also mean that someone who only used MOBi format would not get the same page count showing in Calibre as they would on their Kindle. Whether that is really an "issue" is questionable, and instead the plugin would be useful to more users.
kiwidude is offline   Reply With Quote