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

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 01-16-2009, 03:49 AM   #1
torben
Junior Member
torben began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Dec 2008
Device: Irex iLiad
Problems converting ePub Feed files into Mobipocket Format

Hello there,

I am using an iLiad 2nd Edition here for mobile book reading. A few days ago I stumbled over Calibre and must say that I am very impressed about the application.

After running a few tests i came to the conclusion, that reading feeds using FBReader and ePub on the iLiad isn't ideal, mainly due to FBReaders average ePub support. Images are missing, and the general rendering of the output is average as well, both with the 0.8 version on the iLiad and the current 0.10 on the PC.

So I did some experiments using the closed mobigen tools, which can convert ePub into PRC. Generally it works like a breeze, however there is a stumbling block. Mobigen expects the dc:Language tag to be present in the file (it seems to be mandatory), which is missing in the ePub. It is not really a problem to fix, the epub-meta tool can add it with ease.

My wish now would be some way to automate the Mobipocket conversion, as I want to have an automatic way of feeding my news to the iLiad.

Is it possible, to automatically run tasks after the creation of the feed, some kind of custom post-processing using a custom recipe? With that way I could automatically add the language tag and maybe even convert it to mobipocket and copy the file in question into the right folder.

As a logical extent to that the next question: How hard is it to add Mobipocket as an additional output format at least supported in the Windows World using the mobigen tool? I have quite some programming experience, if it is a task not too time consuming to do I would even consider trying to put a few patches together.

Thanks in advance for any pointers in this matter.


Greetings,
Torben Nehmer
torben is offline   Reply With Quote
Old 01-16-2009, 03:57 AM   #2
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: 26,300
Karma: 5382313
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
calibre should have mobipocket output in about a month, courtesy of llasram
kovidgoyal is offline   Reply With Quote
Old 01-16-2009, 04:30 AM   #3
torben
Junior Member
torben began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Dec 2008
Device: Irex iLiad
Hi there,

that is great to hear. Apart from that, some post-processing function would be good nevertheless for copying purposes. I still need to copy the converted files to their final location.


Greetings,
Torben Nehmer
torben is offline   Reply With Quote
Old 01-16-2009, 06:02 AM   #4
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: 26,300
Karma: 5382313
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Read up on the file type plugins under customizing calibre in the user manual
kovidgoyal is offline   Reply With Quote
Old 01-16-2009, 07:55 AM   #5
torben
Junior Member
torben began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Dec 2008
Device: Irex iLiad
Thanks! I will look into that.

Greetings,
Torben
torben is offline   Reply With Quote
Old 01-16-2009, 08:01 AM   #6
wallcraft
reader
wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.
 
wallcraft's Avatar
 
Posts: 6,979
Karma: 5183568
Join Date: Mar 2006
Location: Mississippi, USA
Device: Kindle 3 and Fire
Quote:
Originally Posted by kovidgoyal View Post
calibre should have mobipocket output in about a month, courtesy of llasram
It may be sooner than that, at least for early adopters, see One last oeb2mobi test.... This includes an example of the calibre 'feeds2epub' of "The Economist" in the original ePub and MOBI.
wallcraft is offline   Reply With Quote
Old 01-16-2009, 01:06 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: 26,300
Karma: 5382313
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Quote:
Originally Posted by wallcraft View Post
It may be sooner than that, at least for early adopters, see One last oeb2mobi test.... This includes an example of the calibre 'feeds2epub' of "The Economist" in the original ePub and MOBI.
Oh I meant the time it will take to integrate it with the GUI, etc.
kovidgoyal is offline   Reply With Quote
Old 01-16-2009, 04:33 PM   #8
torben
Junior Member
torben began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Dec 2008
Device: Irex iLiad
Hello together,

thanks again for the information provided, I am looking forward to the final Mobipocket support.

Until then I am trying to help myself with a File Plugin to convert the files using mobigen. However, since these are my first steps with Python I am a bit lost. I scanned over the forum and found a few hints about how to execut other application from a plugin, however, it does not seem to actually execute, this is the source I am using:

Code:
import os, sys
from calibre.customize import FileTypePlugin

class ePubPostProc(FileTypePlugin):
  name                = 'ePub Postprocessing Plugin'
  description         = 'Sets the Language of an ePub File to German and converts it to Mobipocket using mobigen.'
  supported_platforms = ['windows']
  author              = 'Torben Nehmer, Nathan Syntronics'
  version             = (1, 0, 0)
  file_types          = set(['epub'])
  on_postprocess      = True
  priority            = 100

  def run(self, path_to_ebook):
    from calibre.ebooks.metadata.meta import get_metadata, set_metadata
    file = open(path_to_ebook, 'r+b')
    ext  = os.path.splitext(path_to_ebook)[-1][1:].lower()
    mi = get_metadata(file, ext)
    mi.language = 'Deutsch'
    set_metadata(file, mi, ext)
    close(file)

    subprocess.call('"c:\program files\calibre\mobigen.exe" "' + path_to_ebook + '"', shell=True);

    return path_to_ebook
If I execute the command line in question from an arbitary path, everything works as expected.

Given that the conversion from .epub to .mobi works, two more questions: What are the correct calibre API calls for the following tasks:

1. Add the MOBI File as alternative format to the database. I could use the calibredb command line utility, but I suspect that it easier to do it with the API itself.

2. How to find out if the eBook in question already has a MOBI/PRC file in the library to avoid duplicate conversions?


Greetings,
Torben.

Last edited by torben; 01-16-2009 at 04:36 PM.
torben is offline   Reply With Quote
Old 01-16-2009, 04:37 PM   #9
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: 26,300
Karma: 5382313
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
To debug the plugin, use the command line. It will run for any conversion to EPUB, so you can put som eprint statements and run

Code:
any2epub testfile.html
and see what is happening.

The API for database access is defined in the class LibraryDatabase2, it will have all the methods you need.
kovidgoyal is offline   Reply With Quote
Old 02-12-2009, 12:55 AM   #10
heyjohn
Member
heyjohn began at the beginning.
 
Posts: 16
Karma: 10
Join Date: Dec 2007
Location: New Hampshire, USA
Device: Cybook Gen3/Palm Zire
I'm actually a little frustrated with Calibre right now -- just tried to convert some epubs to mobi yesterday, without luck (neither Cybook nor FBReader seem to like the files). A lot of the frustration is that I couldn't compile Calibre for Fedora 10 (without messing with my KDE install, as it wants qt-4.4.4, which isn't yet released on F10; btw, the release notes are not correct -- the package is qt, not qt4). So I had to try the Windows version, and using Windows sets my teeth on edge. (I'm just that way, I'll tone it down, promise.)

I figured that in the mean time, I'd just do an epub->lit conversion, but that didn't seem to work (Mobi, ePub, LRF, despite choices elsewhere for one-at-a-time conversion). The lit->mobi conversions using clit/mobiperl work wonders every time I've tried 'em.

Is epub->lit just not implemented yet? I was using the version released 10 Feb 2009; I don't have Windows running, so I don't have the version number I used handy.

(Right now, I'm just looking for converters, or easily digestible info for doing the requisite xhtml conversions so I can feed things to mobiperl and have things work nicely. I'm also not a python person, as I tend to code in perl or ruby instead. So... python on windows, ouch; but as I say, that's me. I'm also lazy, otherwise I'd study the specs and write my own, but that's too much like my day job at times.)

Is there a way to just build the command-line tools and avoid Qt, and hopefully provide some decent bug reports rather than making an overly whiny post?
heyjohn is offline   Reply With Quote
Old 02-12-2009, 01:13 AM   #11
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: 26,300
Karma: 5382313
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Yeah getting calibre running on linux can be a pain, I tend to use cutting edge library versions. Have you tried the binary installer?

As for MOBI files that don't work with the Cybook, open a ticket and attach the source files. We usually fix bugs in a matter of days.

The LIT support isn't as developed at the moment, which is why it is not included in the GUI.
kovidgoyal is offline   Reply With Quote
Old 02-12-2009, 06:33 PM   #12
user_none
Sigil & calibre developer
user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.
 
user_none's Avatar
 
Posts: 2,465
Karma: 986493
Join Date: Jan 2009
Location: Florida, USA
Device: Nook STR
Quote:
Originally Posted by heyjohn View Post
Is there a way to just build the command-line tools and avoid Qt, and hopefully provide some decent bug reports rather than making an overly whiny post?
The command line tools cannot be built without Qt. The epub module for instance uses Qt to render the book covers.
user_none is offline   Reply With Quote
Old 02-15-2009, 11:18 PM   #13
heyjohn
Member
heyjohn began at the beginning.
 
Posts: 16
Karma: 10
Join Date: Dec 2007
Location: New Hampshire, USA
Device: Cybook Gen3/Palm Zire
Actually, I was bitten by the following line in pydistutils.py:

QMAKE = os.path.expanduser('~/qt/bin/qmake') if 'darwin' in sys.platform else'qmake'

That's really not a lot of fun if you have qt3-devel and qt-devel-4 installed on your system, as you can in Fedora 10. The default qmake is from qt3, which causes compilation errors. The qt4 version is qmake-qt4, which you can also get as qmake if you have /usr/lib64/qt4/bin first on your $PATH.

So, after changing that line from 'qmake' to 'qmake-qt4', it built just fine. Now to hack together a .spec file so I can have some distro-friendly update management...
heyjohn is offline   Reply With Quote
Old 02-15-2009, 11:33 PM   #14
heyjohn
Member
heyjohn began at the beginning.
 
Posts: 16
Karma: 10
Join Date: Dec 2007
Location: New Hampshire, USA
Device: Cybook Gen3/Palm Zire
Ah, python setup.py bdist_rpm almost builds things for me -- generated a .spec file (with an extra newline on 'Summary:', a fatal bug for rpmbuild), then broke.

So I took the source tar.gz and .spec file and fed those to rpmbuild. Something's wrong with "calibre_postinstall", and I'll take a look as to what.
heyjohn is offline   Reply With Quote
Old 02-16-2009, 01:36 AM   #15
heyjohn
Member
heyjohn began at the beginning.
 
Posts: 16
Karma: 10
Join Date: Dec 2007
Location: New Hampshire, USA
Device: Cybook Gen3/Palm Zire
Okay, after playing with things for a few hours, I have a few questions (which may also double as bug reports; I dunno)...

- Is the calibre_postinstall thing just a validation/test script to see whether all the site-python bits were really installed? If so, it'll make more sense to put a python one-liner into the %post section of the .spec file.

- What are cherrypy, pyPdf, odfpy, and python-cssutils doing as part of this package? Are they modified versions, or taken straight from other projects? I already have them on my system, and do not want to overwrite my distro's versions. That's why I do this RPM thing and not binary installers...
heyjohn 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
[Old Thread] New to Calibre--problems converting files rxmom03 Calibre 4 07-04-2012 10:46 PM
Converting Mobipocket PRC files HarryT Sony Reader 7 12-16-2011 02:46 PM
Help! Newbie having problems converting HTML/CSS files jackie_w Calibre 6 09-14-2009 05:53 PM
Error in converting files html --> Mobipocket adamsloco Calibre 0 08-29-2009 11:30 PM
Problems Converting files using libprs500 nosfuerato Calibre 3 12-27-2007 09:33 AM


All times are GMT -4. The time now is 03:11 PM.


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