Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Conversion

Notices

Reply
 
Thread Tools Search this Thread
Old 09-12-2011, 11:32 PM   #1
LaoTseu
Member
LaoTseu began at the beginning.
 
Posts: 20
Karma: 12
Join Date: Sep 2011
Device: Kindke
ePub to Mobi: can't get the reference type="text" to work

Hi everyone,

I've been banging my head on the walls for a while no trying to get calibre to set the Begin mark properly in the Mobi file when converting an ePub.

Based on what I've in the forums and elsewhere, I tried the following so far:

In the content.opf file
Code:
<guide>
    <reference href="Text/one.html" title="Start" type="text" />
</guide>
Code:
<guide>
    <reference href="Text/one.html" title="Start Here" type="text" />
</guide>
Code:
<guide>
    <reference href="Text/one.html" title="Start Here" type="Start" />
</guide>
Code:
<guide>
    <reference href="Text/one.html" title="Start Here" type="start" />
</guide>
I also tried putting a <a id="Start" /> in the one.html file. Nothing has worked so far.

I'm using caliber 0.8.18 on a Windows XP Pro PC.

Any help would be greatly appreciated.

TIA
LaoTseu is offline   Reply With Quote
Old 09-13-2011, 08:25 AM   #2
LaoTseu
Member
LaoTseu began at the beginning.
 
Posts: 20
Karma: 12
Join Date: Sep 2011
Device: Kindke
Well, it looks like a bug in Calibre. In my latest test, my ePub <guide> section looks like this:

Code:
<guide>
    <reference href="Text/cover.xhtml" title="Cover" type="cover" />
    <reference href="Text/toc.html" title="Table Of Contents" type="toc" />
    <reference href="Text/title_page.html" title="Title Page" type="title-page" />
    <reference href="Text/dedication.xhtml" title="Dedication" type="dedication" />
    <reference href="Text/quote.xhtml" title="Epigraph" type="epigraph" />
    <reference href="Text/one.html" title="Start" type="text" />
</guide>
When I use MobiUnpack.pyw to unpack the .mobi resulting from the calibre conversion, I get the following guide in the mobi opf;

Code:
<guide>
<reference type="text" href="Free Fall - Laura Anne Gilman.html#filepos236" />
<reference type="title-page" title="Title Page" href="Free Fall - Laura Anne Gilman.html#filepos5059" />
<reference type="toc" title="Table Of Contents" href="Free Fall - Laura Anne Gilman.html#filepos689921" />
<reference type="text" title="Start" href="Free Fall - Laura Anne Gilman.html#filepos7192" />
</guide>
The problem appear to be that there are two reference type="text" generated, one that points to filepos236 and the other that points to filepos7192. filepos236 doesn't exists in the html file inside the mobi so that's why the Kindle open at the start of the book.

Could it be something that I'm doing wrong in the ePub that make calibre misbehave?

Last edited by DoctorOhh; 09-13-2011 at 01:40 PM.
LaoTseu is offline   Reply With Quote
Old 09-13-2011, 11:37 AM   #3
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,771
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Use title="start"

That is lowercase start not Start
kovidgoyal is offline   Reply With Quote
Old 09-13-2011, 02:33 PM   #4
LaoTseu
Member
LaoTseu began at the beginning.
 
Posts: 20
Karma: 12
Join Date: Sep 2011
Device: Kindke
Quote:
Originally Posted by kovidgoyal View Post
Use title="start"

That is lowercase start not Start
I'll try it tonight when I'm back home but the entry with "Start" in the resulting mobi files works as intended. It's the extra reference type="text" without title and pointing to a non existing filepos that cause the problem. If I deleted the first reference line of the mobi guide and repackage it, it works just fine even if the title has a capital S.
LaoTseu is offline   Reply With Quote
Old 09-13-2011, 02:55 PM   #5
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,771
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
The entries in the guide are superseded by the contentstart EXTH entry, which will ony be correctly set if you use lowercase start
kovidgoyal is offline   Reply With Quote
Old 09-13-2011, 07:14 PM   #6
LaoTseu
Member
LaoTseu began at the beginning.
 
Posts: 20
Karma: 12
Join Date: Sep 2011
Device: Kindke
I did some tests using title="start" and it works but not always.

First, a working exemple:

The Epub guide:
Code:
<guide>
  <reference href="Text/cover.xhtml" title="Cover" type="cover" />
  <reference href="Text/toc.html" title="Table Of Contents" type="toc" />
  <reference href="Text/title_page.html" title="Title Page" type="title-page" />
  <reference href="Text/dedication.xhtml" title="Dedication" type="dedication" />
  <reference href="Text/quote.xhtml" title="Epigraph" type="epigraph" />
  <reference href="Text/one.html" title="start" type="text" />
</guide>
resulting MOBI OPF guide section
Code:
<guide>
<reference type="text" href="Free Fall - Laura Anne Gilman.html#filepos7332" />
<reference type="title-page" title="Title Page" href="Free Fall - Laura Anne Gilman.html#filepos5059" />
<reference type="toc" title="Table Of Contents" href="Free Fall - Laura Anne Gilman.html#filepos690061" />
<reference type="text" title="start" href="Free Fall - Laura Anne Gilman.html#filepos7332" />
</guide>
</package>
The resulting type="text is there twice and both of them pointing to the same filepos7332. The filepos7332 in question exists in the html file and it located where it should.

Only the first reference is needed. When I remove the second reference type="text" title="start" and repack the mobi, it sill opens where it should.

Second example, I decide that the reader should start reading at the dedication. (This pass all the Epub validation tests so I assume it's valid Epub.)

The Epub guide:
Code:
<guide>
  <reference href="Text/cover.xhtml" title="Cover" type="cover" />
  <reference href="Text/toc.html" title="Table Of Contents" type="toc" />
  <reference href="Text/title_page.html" title="Title Page" type="title-page" />
  <reference href="Text/dedication.xhtml" title="Dedication" type="dedication" />
  <reference href="Text/quote.xhtml" title="Epigraph" type="epigraph" />
  <reference href="Text/dedication.xhtml" title="start" type="text" />
</guide>
resulting Mobi OPF guide section:
Code:
<guide>
<reference type="text" href="Free Fall - Laura Anne Gilman.html#filepos178" />
<reference type="title-page" title="Title Page" href="Free Fall - Laura Anne Gilman.html#filepos5001" />
<reference type="toc" title="Table Of Contents" href="Free Fall - Laura Anne Gilman.html#filepos690003" />
</guide>
This time there is only one reference type="text" and the filepos178 doesn't exist anywhere in the .html file.

I'm not sure if it's easy to fix or not but there is a problem there although the work around is easy.

Also, since the Epub standard clearly states that type="text" always mark the 'First "real" page of content (e.g. "Chapter 1")', I don't think that calibre should bother checking the title at all and just use the first type="text".

That should probably be low on your priority because once we know about it, it's not a big thing to add the title.

And while I'm at it, I always want to thank you for the great job you do on calibre.

Best
LaoTseu is offline   Reply With Quote
Old 09-13-2011, 07:46 PM   #7
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,771
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
calibre is designed to convert files from arbitrary sources that can be arbitrarily messed up. As such relying on files complying with the EPUB spec is very optimistic

There was a regression in 0.8.18 that made the set of guide entries that worked smaller than in 0.8.17. That has been fixed for 0.8.19.

Basically the (fixed) algorithm is that either title or type must be start (case independent) and the last entry wins in case of multiple matches.

And note that the entries that end up in the <guide> in the MOBI file are irrelevant. The new calibre MOBI engine (in 0.8.18) writes contentstart into the EXTH header, which is always used by the Kindle in preference to whatever is in <guide>.
kovidgoyal is offline   Reply With Quote
Old 09-14-2011, 12:06 AM   #8
LaoTseu
Member
LaoTseu began at the beginning.
 
Posts: 20
Karma: 12
Join Date: Sep 2011
Device: Kindke
Thanks you for this. Having to just put the title to whichever guide reference we want the Kindle to use will be quite simple indeed.

Also, thanks for the clarification about EXTH header. I'm guessing my way worked because I was using MobiPocket Creator to "repackage" and it probably just use the guide to set everything else.
LaoTseu is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Ebook not starting at "first" page after converting from epub to mobi bfollowell Conversion 7 08-01-2011 12:52 PM
Epub to Mobi - missing chapters "Demo Verison Limitations" LynneWhite Calibre 3 12-31-2010 04:52 AM
EPUB to MOBI: "Failed: Convert book 1 of 1" Jillo Introduce Yourself 4 02-20-2010 06:49 PM
"PK": Only text when I open in Sigil an ePub file generated with Calibre Terisa de morgan Sigil 3 12-14-2009 11:24 AM
Content Mobi Reference ("Huge Collections") on Kindle Mike L Amazon Kindle 26 04-28-2009 03:14 PM


All times are GMT -4. The time now is 07:01 AM.


MobileRead.com is a privately owned, operated and funded community.