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

Go Back   MobileRead Forums > E-Book Formats > Kindle Formats

Notices

Reply
 
Thread Tools Search this Thread
Old 12-24-2009, 04:58 AM   #1
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 7,515
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Unpacking/repacking mobi books

I think I have already asked this, but I don't think I got a definitive answer/solution.

I have bought some mobipocket books and, as you probably know, they have often deficient/faulty/missing metadata and/or covers (not to talk about the text formatting). Fixing that would be easy with MobiPerl's mobi2mobi or with Calibre's ebook-meta, but sometimes the books are in the generic PRC format (not MOBI) that does not allow adding covers or whatever. When possible, I've been using mobi2html to extract the html and then recreate the book as a proper mobi file, with the correct metadata and covers, but this does not always work, just today I found a book that loses all images in this way (the resulting HTML code has only <img alt="whatever">, but no src and no image files are created).

So, I'd like a working way to extract the contents of a mobi file or to convert from PRC to MOBI. Calibre, as far as I can tell, is no good, because it processes and does all kind of modifications on the HTML/CSS code (or can this be disabled?). MobiPerl's "mobi2html --rawhtml" would be good, I guess, but it does never extract images (and links are given as "filepos", which is not quite convenient).

Is there really no better way to add covers and metadata to a PRC book?
Jellby is offline   Reply With Quote
Old 12-24-2009, 05:43 AM   #2
pdurrant
The Grand Mouse 高貴的老鼠
pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.
 
pdurrant's Avatar
 
Posts: 71,484
Karma: 305784726
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle Voyage
PRC ebooks that are not Mobipocket ebooks can be in a variety of different formats.

What format are these ebooks, if not Mobi?

Quote:
Originally Posted by Jellby View Post
sometimes the books are in the generic PRC format (not MOBI) that does not allow adding covers or whatever.
pdurrant is offline   Reply With Quote
Advert
Old 12-24-2009, 07:12 AM   #3
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,488
Karma: 1063785
Join Date: Jan 2009
Location: Florida, USA
Device: Nook STR
You can use calibre's command line ebook-convert with the --debug destination/ option. destination/input will give you the un-processed files you're looking for.
user_none is offline   Reply With Quote
Old 12-24-2009, 07:37 AM   #4
tompe
Grand Sorcerer
tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.
 
Posts: 7,452
Karma: 7185064
Join Date: Oct 2007
Location: Linköpng, Sweden
Device: Kindle Voyage, Nexus 5, Kindle PW
If you just run mobi2mobi and save as a new file the new file should be a MobiPocket file and images should work. So if you do not need to fox the text formatting it is unnecessary to unpack the book.
tompe is offline   Reply With Quote
Old 12-24-2009, 07:56 AM   #5
HarryT
eBook Enthusiast
HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.
 
HarryT's Avatar
 
Posts: 85,544
Karma: 93383043
Join Date: Nov 2006
Location: UK
Device: Kindle Oasis 2, iPad Pro 10.5", iPhone 6
Quote:
Originally Posted by pdurrant View Post
PRC ebooks that are not Mobipocket ebooks can be in a variety of different formats.

What format are these ebooks, if not Mobi?
It's the "old" Mobi format - the one that Book Designer creates, for example. These books have a "file tag" of "Text/Read" rather than "Book/Mobi", and then don't store any metadata other than (I think) the book title.
HarryT is offline   Reply With Quote
Advert
Old 12-24-2009, 08:00 AM   #6
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 7,515
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Quote:
Originally Posted by user_none View Post
You can use calibre's command line ebook-convert with the --debug destination/ option. destination/input will give you the un-processed files you're looking for.
Yes, I've found that, thanks. But it converts the images to JPG (whereas mobi2html gave BMP files for the same book). Also, how would I recreate the mobi without involving all the usual Calibre parsing and processing?

Quote:
Originally Posted by tompe View Post
If you just run mobi2mobi and save as a new file the new file should be a MobiPocket file and images should work. So if you do not need to fox the text formatting it is unnecessary to unpack the book.
Really? I think I tried some time with that, and it didn't work... I'll try again.
Jellby is offline   Reply With Quote
Old 12-24-2009, 10:20 AM   #7
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 7,515
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Quote:
Originally Posted by tompe View Post
If you just run mobi2mobi and save as a new file the new file should be a MobiPocket file and images should work. So if you do not need to fox the text formatting it is unnecessary to unpack the book.
Let's see. Just running mobi2mobi and trying to change the cover gave me:

Code:
Invalid type '-' in unpack at /home/ignacio/bin/mobiperl/MobiPerl/EXTH.pm line 268.
The doctype is MOBI, so maybe the "old PRC format" issue is not the problem. Apparently ebook-meta can set the cover for this file. For another file, however, ebook-meta fails with "ValueError: non-existent record 4294968689L", while mob2mobi silently fails to set the cover (it does not give an error, but after that it still says "ERROR: No cover image in book").

Really, this is a pain in you know where
Jellby is offline   Reply With Quote
Old 12-24-2009, 04:53 PM   #8
tompe
Grand Sorcerer
tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.
 
Posts: 7,452
Karma: 7185064
Join Date: Oct 2007
Location: Linköpng, Sweden
Device: Kindle Voyage, Nexus 5, Kindle PW
What I meant was that you first do "mobi2mobi oldfile.prc --outfile newfile.mobi" and then try to set the meta data on newfile.mobi.

But the error message is a bit strange. mobi2mobi seem to think that the file have EXTH headers since "if ($exthflg & 0x40)" seems to become true. And that should not happen if it is not a real MobiPocket file. So you could try to add "& false" to this if condition to see if that works.
tompe is offline   Reply With Quote
Old 12-25-2009, 05:58 AM   #9
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 7,515
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Quote:
Originally Posted by tompe View Post
What I meant was that you first do "mobi2mobi oldfile.prc --outfile newfile.mobi" and then try to set the meta data on newfile.mobi.
I tried that too. Same result. Could the absence of cover after adding it be related to this piece of output?

Code:
EXTH    item: 203 - hasFakeCover - 4 - 0x0000
Quote:
But the error message is a bit strange. mobi2mobi seem to think that the file have EXTH headers since "if ($exthflg & 0x40)" seems to become true. And that should not happen if it is not a real MobiPocket file. So you could try to add "& false" to this if condition to see if that works.
Yes, it seems this files are problematic. How would I do the change? I tried with "if (($exthflg & 0x40) & false)", but I got:

Code:
Bareword "false" not allowed while "strict subs" in use at /home/ignacio/bin/mobiperl/mobi2mobi line 608.
Commenting out the "use strict" line gave me the same "Invalid type" message
Jellby is offline   Reply With Quote
Old 12-25-2009, 06:21 AM   #10
tompe
Grand Sorcerer
tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.
 
Posts: 7,452
Karma: 7185064
Join Date: Oct 2007
Location: Linköpng, Sweden
Device: Kindle Voyage, Nexus 5, Kindle PW
Aha, I probably misremembered (too much C++ lately). Use 0 instead of false.
tompe 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
Mobi books, same experience as kindle? abvmoose Amazon Kindle 4 08-04-2010 11:44 AM
Kindle dictionary and .mobi books? yuriman2002 Amazon Kindle 2 03-02-2010 11:04 AM
Can Mobi books be 'exploded' AnemicOak Kindle Formats 26 03-18-2009 03:16 PM
new books in mobi format sassanik IMP 11 09-08-2008 09:40 AM
New and improved Mobi books for Gen3 HarryT Bookeen 9 11-19-2007 05:55 AM


All times are GMT -4. The time now is 05:36 PM.


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