12-24-2009, 04:58 AM | #1 |
frumious Bandersnatch
Posts: 7,516
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? |
12-24-2009, 05:43 AM | #2 |
The Grand Mouse 高貴的老鼠
Posts: 71,506
Karma: 306214458
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle Voyage
|
|
Advert | |
|
12-24-2009, 07:12 AM | #3 |
Sigil & calibre developer
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.
|
12-24-2009, 07:37 AM | #4 |
Grand Sorcerer
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.
|
12-24-2009, 07:56 AM | #5 |
eBook Enthusiast
Posts: 85,544
Karma: 93383043
Join Date: Nov 2006
Location: UK
Device: Kindle Oasis 2, iPad Pro 10.5", iPhone 6
|
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.
|
Advert | |
|
12-24-2009, 08:00 AM | #6 | |
frumious Bandersnatch
Posts: 7,516
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Quote:
Really? I think I tried some time with that, and it didn't work... I'll try again. |
|
12-24-2009, 10:20 AM | #7 | |
frumious Bandersnatch
Posts: 7,516
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Quote:
Code:
Invalid type '-' in unpack at /home/ignacio/bin/mobiperl/MobiPerl/EXTH.pm line 268. Really, this is a pain in you know where |
|
12-24-2009, 04:53 PM | #8 |
Grand Sorcerer
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. |
12-25-2009, 05:58 AM | #9 | ||
frumious Bandersnatch
Posts: 7,516
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Quote:
Code:
EXTH item: 203 - hasFakeCover - 4 - 0x0000 Quote:
Code:
Bareword "false" not allowed while "strict subs" in use at /home/ignacio/bin/mobiperl/mobi2mobi line 608. |
||
12-25-2009, 06:21 AM | #10 |
Grand Sorcerer
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.
|
|
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 |