Error converting zipped html with metadata

Asked by Nicolas Toniazzi

Hello,

I'd like to convert a ZIP archive to MOBI using Calibre. The ZIP contains an HTML file, some pictures and a manifest.opf file. When converting the ZIP, Calibre generates an error : "Spine is empty". It seems that it's trying to parse the OPF file with an HTML parser and cannot find the <html> tag.

Is it allowed to put an OPF file inside a ZIP?

Question information

Language:
English Edit question
Status:
Expired
For:
Ubuntu calibre Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Launchpad Janitor (janitor) said :
#1

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Revision history for this message
Nicolas Toniazzi (nicolas-toniazzi-deactivatedaccount) said :
#2

Found it.
The file must have a .htmlz extension.
The OPF file needs an extra <manifest> section containing an <item> whose id matches the name of a <meta content="cover"> item:

    <?xml version='1.0' encoding='utf-8'?>
    <package xmlns="http://www.idpf.org/2007/opf">
        <metadata xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:opf="http://www.idpf.org/2007/opf">
            ...
            <meta content="cover" name="cover"/>
        </metadata>
        <manifest>
            <item id="cover" media-type="image/jpeg" href="images/cover.jpg"/>
        </manifest>
    </package>

The cover will then be fetched from "images/cover.jpg"