Wrong metadata.opf generated for cover in EPUB to AZW3 conversion

Bug #1268657 reported by Raúl Núñez de Arenas Coronado on 2014-01-13
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
calibre
Undecided
Unassigned

Bug Description

calibre 1.19 portable running under Windows 7 Home Premium SP1

This bug (well, I'm still not sure it is a bug) is a bit difficult to explain.

Let's say I have a very simple EPUB with an included cover. There is also an HTML cover, and the metadata regarding the cover looks like this:

<metadata xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:opf="http://www.idpf.org/2007/opf">
    [...]
    <meta name="cover" content="cover.jpg" />
  </metadata>
  <manifest>
    <item href="Text/cover.xhtml" id="cover.xhtml" media-type="application/xhtml+xml" />
    <item href="Images/cover.jpg" id="cover.jpg" media-type="image/jpeg" />
    [...]
  </manifest>
  <spine toc="ncx">
    <itemref idref="cover.xhtml" />
    [...]
  </spine>
  <guide>
    <reference href="Text/title.xhtml" title="Title Page" type="title-page" />
    <reference href="Text/toc.xhtml" title="Table Of Contents" type="toc" />
    <reference href="Text/cover.xhtml" title="Cover" type="cover" />
    <reference href="Text/part01.xhtml" title="Text" type="text" />
  </guide>

When converting to AZW3 using "ebook-convert.exe test.epub test.azw3" I expected to have this in the guide part of metadata.opf file of the resulting AZW3 file:
<guide>
    <reference href="text/part0002.html" type="text" title="Text"/>
    <reference href="text/part0001.html" type="title-page" title="Title Page"/>
    <reference href="text/part0000.html" type="toc" title="Table Of Contents"/>
    <reference href="images/00001.jpeg" type="cover"/>
    <reference href="images/00001.jpeg" type="other.ms-coverimage-standard"/>
    <reference href="images/00001.jpeg" type="other.ms-coverimage"/>
  </guide>

Instead, I get this:

<guide>
    <reference href="text/part0003.html#cover" type="other.titlepage" title="Title Page"/>
    <reference href="text/part0002.html" type="text" title="Text"/>
    <reference href="text/part0001.html" type="title-page" title="Title Page"/>
    <reference href="text/part0000.html" type="toc" title="Table Of Contents"/>
    <reference href="images/00001.jpeg" type="cover"/>
    <reference href="images/00001.jpeg" type="other.ms-coverimage-standard"/>
    <reference href="images/00001.jpeg" type="other.ms-coverimage"/>
  </guide>

That is, "Title Page" appears twice but the first one is the HTML cover, and that shows in the Go To menu of my Kindle Touch.

Now, the weirdest part. If I do the conversion using the GUI, with default options, I actually get the correct guide, works like a charm, UNLESS I check the "Use cover from source file" option. If I check that option, then I get the wrong guide.

I've debugged the output and the only difference is that the GUI, by default (that is, "Use cover from source file" unchecked), dumps the cover to an external file and uses the "--cover" option in ebook-convert. Since the command line tool uses the internal cover, it always shows the problem.

Also, both in the GUI and ebook-convert, I get this message and I don't know if it is related to this behaviour:
Spine-referenced file u'OEBPS/Text/cover.xhtml' not in spine

Thanks again in advance.

Since I can't attach all files in this bug report I'm providing you some links:

https://dl.dropboxusercontent.com/u/76090389/test.epub is a minimal EPUB showing the problem
https://dl.dropboxusercontent.com/u/76090389/good.azw3 is the conversion result using the GUI, with correct guide
https://dl.dropboxusercontent.com/u/76090389/bad.azw3 is the conversion result using the command line tool, with incorrect guide

Again, thanks

Fixed in branch master. The fix will be in the next release. calibre is usually released every Friday.

 status fixreleased

Changed in calibre:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers