![]() |
#1 |
Junior Member
![]() Posts: 2
Karma: 10
Join Date: Jul 2014
Device: any ereader
|
![]()
Is there really a way to use zip on the command line to create an epub file that validates properly with epubcheck? I have tried every sequence of command line commands that I can find on the Internet and they all say they work, but I get exactly the same errors no matter how I do it. I suspect that the people who claim that zip creates valid epub files have not validated them with epubcheck. The files this method creates seem to work on a few ereaders, but not all of them, and it always fails epubcheck.
Here is one of the typical ways that I've tried to do it, but it always gives me the same errors. Code:
$ rm ./test-epub-3-0-1.epub $ zip -X0 ./test-epub-3-0-1.epub mimetype adding: mimetype (stored 0%) $ zip -rDX9 ./test-epub-3-0-1.epub META-INF -x mimetype adding: META-INF/container.xml (deflated 30%) $ zip -rDX9 ./test-epub-3-0-1.epub OEBPS -x mimetype adding: OEBPS/cover.xhtml (deflated 29%) adding: OEBPS/title_pages.xhtml (deflated 30%) adding: OEBPS/chapter01.xhtml (deflated 30%) adding: OEBPS/epub.css (stored 0%) adding: OEBPS/toc.xhtml (deflated 32%) adding: OEBPS/chapter03.xhtml (deflated 30%) adding: OEBPS/notes.xhtml (deflated 30%) adding: OEBPS/MyBook.opf (deflated 67%) adding: OEBPS/chapter02.xhtml (deflated 33%) $ cd .. $ java -jar epubcheck-3.0.1/epubcheck-3.0.1.jar test-epub-3-0-1.epub Epubcheck Version 3.0.1 ERROR: test-epub-3-0-1.epub: Mimetype entry must not have an extra field in its ZIP header Validating against EPUB version 3.0 ERROR: test-epub-3-0-1.epub/mimetype: Mimetype file should contain only the string "application/epub+zip". ERROR: test-epub-3-0-1.epub/XHTML/MyBook.opf(2,161): element "package" missing required attribute "unique-identifier" ERROR: test-epub-3-0-1.epub/XHTML/MyBook.opf(2,161): unique-identifier attribute in package element must be present and have a value ERROR: test-epub-3-0-1.epub/XHTML/MyBook.opf(9,13): element "metadata" incomplete; missing required element "dc:identifier" ERROR: test-epub-3-0-1.epub/XHTML/MyBook.opf(3,12): assertion failed: package dcterms:modified meta element must occur exactly once ERROR: test-epub-3-0-1.epub/XHTML/MyBook.opf(10,12): assertion failed: Exactly one manifest item must declare the 'nav' property (number of 'nav' items: 0). ERROR: test-epub-3-0-1.epub/XHTML/MyBook.opf: unique-identifier attribute in package element must reference an existing identifier element id Does anyone have any recommendations on how I might be able to do this so that epubcheck will validate the file? |
![]() |
![]() |
![]() |
#2 |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,546
Karma: 19001583
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
I use a script like this all the time:
Code:
#!/bin/bash rm -f "$1" zip -X0 "$1" mimetype zip -X9Dr "$1" META-INF OEBPS Now, the question is, what is the content of your "mimetype" file? It should be: Code:
application/epub+zip |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
Your problem is not the zip commands, but the content...
|
![]() |
![]() |
![]() |
#4 |
Junior Member
![]() Posts: 2
Karma: 10
Join Date: Jul 2014
Device: any ereader
|
The contents of my mimetype file are exactly what Jellby shows in the example, with no newline character, and I have not been able to eliminate that error. I haven't begun to look at the other errors. Will epubcheck show errors for the mimetype file if the real problem is in some other file?
Last edited by bquinn; 07-17-2014 at 10:46 AM. |
![]() |
![]() |
![]() |
#5 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,772
Karma: 103362673
Join Date: Apr 2011
Device: pb360
|
Quote:
od -t x1 mimetype |
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Ex-Helpdesk Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
I would suggest using ebook-convert (the command-line interface to calibre's conversion utility).
![]() Also, epubcheck is reporting "ERROR: test-epub-3-0-1.epub/mimetype: Mimetype file should contain only the string "application/epub+zip"." which seems to indicate that there is something fishy there. |
![]() |
![]() |
![]() |
#7 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
Quote:
Other than that, your OPF is not correct. You are missing an identifier and it seems not to be complete. Did you create the OPF by hand? |
|
![]() |
![]() |
![]() |
#8 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,772
Karma: 103362673
Join Date: Apr 2011
Device: pb360
|
Quote:
od -t x1 mimetype in a message here do the same thing and short circuit all ambiguities and miscommunications that happen when people attempt to discuss technical details in natural language? |
|
![]() |
![]() |
![]() |
#9 |
Ex-Helpdesk Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
The obvious solution is to use calibre, whose job is to package ebooks. The command-line interface to the conversion module accepts an OPF as input.
![]() Or use the editor which handles all packaging and leaves you free to focus on the content. Oh yeah, and I think Kovid finished the plugin system because it's an optional toolbar in the editor now. So extra functionality can be added in new an excitind ways. Last edited by eschwartz; 07-18-2014 at 04:17 PM. |
![]() |
![]() |
![]() |
#10 |
Junior Member
![]() Posts: 2
Karma: 10
Join Date: Mar 2015
Location: Potsdam, Germany
Device: Kobo Aura
|
Create the ebook with the -X option, to stop it adding the "extra field" to the zip (the first error message), and '-Z store' to avoid compressing the mimetype file.
The mimetype file should have length 20 bytes. Check with command 'ls -l'. If the length is greater, you probably have a newline at the end. But most editors put this on automatically. To make a mimetype file, echo -n "application/epub+zip" > mimetype Then create the book like this (change names where appropriate) zip -Z store -Xr MyBook.epub mimetype zip -r MyBook.epub META-INF/ zip -r MyBook.epub Content/ Cheers! |
![]() |
![]() |
![]() |
Tags |
epub zip epubcheck |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
"Remove the dependency on the zip command line tool when developing plugins"? | JimmXinu | Plugins | 2 | 07-13-2012 02:09 PM |
Ebook conversion (EPUB to MOBI) via command line | ebooklab | Conversion | 4 | 09-16-2011 09:34 PM |
Command line conversion of a URL to ePub | bmwr1200c | Recipes | 3 | 08-11-2011 02:42 PM |
How to specify command line option for epub format | kiklop74 | Calibre | 15 | 05-14-2010 04:24 AM |
Any command line to edit epub meta data? | bthoven | ePub | 2 | 03-25-2010 04:15 AM |