08-19-2018, 09:15 AM | #1 |
Witchman
Posts: 628
Karma: 788808
Join Date: May 2013
Location: Philippines
Device: Android S5
|
[KDPValidator] Validate epubs for KDP upload only
Validate epubs for Amazon Kindle upload only Requirements Plugin Type: Validation MIT Licence(OSI) Minimum Sigil requirement: v0.9.3 or higher Python Requirements: Python 3.4+ (Bundled or External) OS Requirements: Windows, Linux or OSX *** Tested on Windows 7, 8 & 10 only *** Current Version: "0.1.3" Installation * Select Manage Plugins from the Plugins menu. In the dialog box, select either the Bundled Python or the External Python(Python 3.4+ should be installed on your computer to run this plugin externally). * Click Add Plugin and select KDPValidator_vXXX.zip. This will load and install the plugin into Sigil, which you can then run by selecting Plugins > Validation > KDPValidator Description This plugin checks and validates epubs for Amazon Kindle upload only and should be used for epub 2.0 ebooks that are going to be viewed on KF8 or KF7 devices. This plugin gives the user a last quick check before upload to KDP. The plugin checks for the following: * Unsupported html tags. * Usupported html attributes. * Unsupported style attributes in the css, html <styles> and html inline styling(very basic check). * Cover pages not allowed warning.(added in v0.1.2) * Bad ebook image format. * Bad internal links * SVG image warning * Flags ebook images smaller than max page size that are not dual formatted * Non-use of heading styles. * Inappropriate use of absolute values in the css. * Missing TOC file. * Logical TOC does not contain the same toc items as the epub TOC file. * Missing or too many opf guide references. * Look Inside formatting issues. User Suppressed Warnings(added in v0.1.2) The plugin user can now turn off or suppress any plugin warning by accessing the KDPValidator.json file and changing any of the listed warning values to "false". Initial default warning values are all set to "true". Caveat Be aware that if you've used an epub converter that uses indexed styling -- such as calibre23, scrivener15 etc -- then only a few of the plugin's css checks can be run. However, all further checks on the epub's content.opf, toc.ncx and xhtml files should run without any problems. Plugin Run * First load your epub into Sigil, run Epubcheck and ensure there are no errors. * Run this plugin. All errors/warnings will be displayed in the validation pane. Changes Spoiler:
Last edited by slowsmile; 09-02-2018 at 07:21 AM. |
08-20-2018, 01:58 AM | #2 |
just an egg
Posts: 1,714
Karma: 6653246
Join Date: Mar 2015
Device: Kindle, iOS
|
|
Advert | |
|
08-20-2018, 12:06 PM | #3 |
Guru
Posts: 697
Karma: 150000
Join Date: Feb 2010
Device: none
|
I've just tried it on one of our production files, and it looks like it's going to be helpful.
One question, though. I'm getting the "[GENERAL WARNING]: Cover image file not found" message. Where does it expect the image file to be? It's in the Images directory, and is correctly pointed to in the "cover" guide entry, and in the manifest and spine, and more importantly looks fine at Amazon, including "Look Inside" so I'm guessing Amazon is OK with it. Other warnings about tweaks to the body style and the guide section were reasonable. Thanks for your work! Albert |
08-20-2018, 12:12 PM | #4 |
Witchman
Posts: 628
Karma: 788808
Join Date: May 2013
Location: Philippines
Device: Android S5
|
@st_albert...The plugin searches for cover.xhtml or titlepage.xhtml(if you converted to epub using Calibre). And it also searches for cover.html and titlepage.html. Only these cover file names will work with this plugin. So if you use other cover file names in your epub, besides the ones I've mentioned, then you will get the Cover file not found error.
I've also just tested the plugin again using several different epubs that use cover.xhtml as the cover file name and I didn't get the "Cover file not found" error with any of them. Last edited by slowsmile; 08-20-2018 at 12:30 PM. |
08-20-2018, 12:17 PM | #5 | |
Guru
Posts: 697
Karma: 150000
Join Date: Feb 2010
Device: none
|
Quote:
Albert |
|
Advert | |
|
08-20-2018, 02:02 PM | #6 |
Sigil Developer
Posts: 8,233
Karma: 5450818
Join Date: Nov 2009
Device: many
|
perhaps parsing the opf guide and/or the nav landmarks to get the name of the xhtml file that contains the cover image might make things more general
|
08-20-2018, 02:17 PM | #7 | |
Guru
Posts: 697
Karma: 150000
Join Date: Feb 2010
Device: none
|
Quote:
But why tempt fate? The guide element for "cover" points to the Image/cover.jpg file itself. Kindlegen likes this, but it will cause epubcheck to bark. I guess one could parse the cover guide element and then check to see if the .jpg file is where the guide says it is, and if so consider that the cover image to check for the other properties (size, whatever else is checked). Albert |
|
08-20-2018, 02:45 PM | #8 | |
Grand Sorcerer
Posts: 5,645
Karma: 23456789
Join Date: Dec 2010
Device: Kindle PW2
|
Quote:
For example: Code:
<meta content="cover.jpg" name="cover" /> If you create epub3 books, you'll need to mark cover images in the OPF manifest section with a properties="cover-image" attribute. For more information see section 4.2 of the Kindle Publishing Guidelines. IIRC, Sigil will automatically add the proper attribute(s) if you use the cover image semantics option. |
|
08-20-2018, 08:01 PM | #9 |
Witchman
Posts: 628
Karma: 788808
Join Date: May 2013
Location: Philippines
Device: Android S5
|
@odamizu...I didn't include checks for epub 3 for several reasons. First, standard epub 3 is essentially html5 snd can be checked using Epubcheck. For Kindle epub 3 you would have to include checks for KF8 and KFX which is Kindle's own brand of fixed format. I also found that the differences between KFX, KF8 and standard epub 3 were badly documented and unreliable. That's really why my plugin doesn't check Kindle epub 3 ebooks.
|
08-21-2018, 12:17 PM | #10 |
Guru
Posts: 697
Karma: 150000
Join Date: Feb 2010
Device: none
|
It does, and I use it. In my cases, the manifest ID is an x prepended to the file name (perhaps because my filenames start with a number?). So you could go that route, but if you needed the path to the image, you'd need to look up the ID in the manifest or the guide element.
|
08-22-2018, 06:40 AM | #11 |
Witchman
Posts: 628
Karma: 788808
Join Date: May 2013
Location: Philippines
Device: Android S5
|
Update: Changes in v0.1.1:
* Changed from using standard cover file names to using the proper cover name derived from the guide cover href for searches in the cover file checks. With thanks to KevinH for the suggested change. |
08-22-2018, 11:34 AM | #12 | ||
Guru
Posts: 697
Karma: 150000
Join Date: Feb 2010
Device: none
|
Quote:
Code:
[ERROR]: Bad cover position. The cover image file should always be the first file in Sigil's Book Browser file list. Quote:
I also mentioned this in a previous post (#7) in this thread. Edited to add: My apologies. It seems I may have mislead you when I said I was using Code:
<guide>
<reference type="cover" title="Cover" href="Images/9781606192863.jpg"/>
...
</guide>
Code:
<metadata xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:opf="http://www.idpf.org/2007/opf"> ... <meta name="cover" content="x9781606192863.jpg" /> </metadata> <manifest> ... <item id="x9781606192863.jpg" href="Images/9781606192863.jpg" media-type="image/jpeg"/> </manifest> Since the latter is what Amazon requires (cf. p. 15 of the Guidelines), I would recommend you check for it instead of the guide reference. Sorry about that! Albert Last edited by st_albert; 08-22-2018 at 12:00 PM. |
||
08-22-2018, 10:35 PM | #13 | |
Witchman
Posts: 628
Karma: 788808
Join Date: May 2013
Location: Philippines
Device: Android S5
|
@st_albert...You've raised several issues and I have to say that I don't agree with you on most of your suggestions. This is going to take some explaining, so bear with me.
Quote:
Now to all the reasons why I still consider using the opf guide cover reference as the best way to get the cover file name. Your suggestion about using the metadata cover reference would fail because it does not take into account all instances of epubs being produced from different doc-to-epub converters. To illustrate this, here is the metadata cover ref I get in the opf metadata when I load an epub created by Scrivener into Sigil: <meta content="cover-image" name="cover" /> How can I get the cover file name from that line? What I really want is the href, which is not there. Also, you cannot rely on 'name="cover"' being the name of the cover file. You really need the href to be sure. You also cannot use the landmark nav ref in the toc.ncx due to the fact that not every indie author puts a cover reference in the Logical TOC for their KDP ebooks. I've seen plenty of ebooks with a Logical TOC that does not have a cover entry. So this method is also not a reliable way to get the cover file name. The only two searchable references that you should be able to use to get the cover file name are the cover "id" in the manifest or the cover "type" in the opf guide because they both contain hrefs. Manifest cover ref: <item id="cover" href="Text/cover.xhtml" media-type="application/xhtml+xml"/> OPF guide cover ref: <reference type="cover" title="Cover" href="Text/cover.xhtml"/> My own preference is to use the opf guide ref because 'type="cover"' is usually the same across all doc-to-epub converters whereas I'm not so sure about how the manifest cover id name might vary across different doc-to-epub converter outputs. Last edited by slowsmile; 08-23-2018 at 12:58 AM. |
|
08-23-2018, 03:24 AM | #14 | |
Grand Sorcerer
Posts: 5,645
Karma: 23456789
Join Date: Dec 2010
Device: Kindle PW2
|
Quote:
Code:
metadata_soup = BeautifulSoup(bk.getmetadataxml(), 'lxml') cover_image = metadata_soup.find('meta', {'name' : 'cover'}) if cover_image: cover_id = cover_image['content'] cover_href = bk.id_to_href(cover_id) Last edited by Doitsu; 08-23-2018 at 03:27 AM. |
|
08-23-2018, 03:54 AM | #15 |
Witchman
Posts: 628
Karma: 788808
Join Date: May 2013
Location: Philippines
Device: Android S5
|
@Doitsu...Yes, I use bk.id_to_href() all over the place in my plugin to get file names.
But I tried an experiment. In a valid epub, I changed the cover file refs from "cover" to "noddy" in the metadata, manifest and spine. And when I ran Epubcheck the epub passed without any problems at all which surprised me. The point I'm making here is that those cover ids can really be anything you like -- they don't have to be "cover" and as long as those cover ids -- any cover id from any doc-to-epub converter -- are implemented in the metadata, manifest and spine then your epub will be valid. This also means that epub converters can indeed use other cover ids besides "cover" in the epub if they want. Like I said, this surprised me because searching for the metadata cover ref using "cover" does not seem to satisfy the maxim "in all possible test instances". |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Trying to Upload my Ebook to KDP | kgjones | Calibre | 5 | 09-16-2015 09:07 AM |
Upload to KDP | Peter21 | Kindle Formats | 4 | 03-06-2014 04:01 PM |
KDP Adds $1.5 Million Holiday Bonus for KDP Select Authors | DreamWriter | Writers' Corner | 3 | 11-29-2012 11:51 PM |
KDP Upload and Writer2ePub | teh603 | Writer2ePub | 1 | 09-22-2012 03:19 AM |