View Full Version : mobi2lrf

02-15-2008, 09:29 AM
After an 8-hour hackathon I'm happy to announce mobi2lrf. Converts (non DRMed) .mobi/.prc files to LRF. Supports all three levels of compression in .mobi files. Also converts metadata. Part of libprs500 v0.4.37 ( It's integrated into the GUI as well as a commandline tool, so using it is just as easy as using the rest of libprs500.

This is an initial release, so it likely is crawling with bugs. Thanks to darkninja for the HUFF/CDIC decompression code.

02-15-2008, 09:53 AM

02-15-2008, 09:57 AM
This is great, thanks Kovid.

02-15-2008, 10:14 AM
Jolly good show!

02-15-2008, 03:41 PM

02-15-2008, 07:01 PM
I just took a look at the changelog. Very impressive!

02-15-2008, 08:21 PM
Thanks :)

02-15-2008, 10:20 PM
Good stuff, converted 2 books thus far. Didn't notice any bugs

02-18-2008, 07:19 PM
Thanks so much. It is a god send for us with both Kindle & PRS.

I tried with one of my mobi file and it seemed that the ToC identification/generation was not working.

02-18-2008, 07:23 PM
I'm going to grab a few mobi format eBooks from the library and try mobi2lrf to test it out.

02-18-2008, 08:23 PM
Yeah the mobi files probably use special markup for the TOC. If someone can send me a few samples I can fix that.

02-18-2008, 09:57 PM
I'll dig up a few Mobi files and send them your way tomorrow.

02-23-2008, 12:42 PM
HI Kovid: I am so happy to see you getting around to MOBI PRC's... I tested the program this morning and found that it has problems with all my MOBI files (all non-DRM'ed from a single source in .NL)

Here's the error messages:

IndexError: string index out of range
Failed to perform job: Convert book:This_Means_War
Detailed traceback:
Traceback (most recent call last):
File "", line 95, in run_job
File "libprs500\ebooks\lrf\any\convert_from.pyo", line 166, in main
File "libprs500\ebooks\lrf\any\convert_from.pyo", line 143, in process_file
File "libprs500\ebooks\lrf\mobi\convert_from.pyo", line 40, in process_file
File "libprs500\ebooks\lrf\mobi\convert_from.pyo", line 29, in generate_html
File "libprs500\ebooks\mobi\reader.pyo", line 168, in extract_content
File "libprs500\ebooks\mobi\reader.pyo", line 213, in extract_text
File "libprs500\ebooks\mobi\huffcdic.pyo", line 123, in decompress
File "libprs500\ebooks\mobi\huffcdic.pyo", line 116, in sizeof_trailing_entries
File "libprs500\ebooks\mobi\huffcdic.pyo", line 104, in sizeof_trailing_entry
IndexError: string index out of range

I hope you can fix it -- as I have 3GB of MOBI files I would like to convert!
Thanks for ALL your efforts!

02-23-2008, 12:56 PM
Send me one of these files.

02-24-2008, 02:08 PM

Thanks for the reply! Here's a random PRC file from this site in .NL that converts fanfic into PRC format for the palm. I have about 1200 of these files!

-- Bob

02-24-2008, 02:41 PM
Will be fixed in the next release.

02-24-2008, 05:48 PM
html2mobi will not properly explode 408.prc. My guess it's highly compressed.

02-24-2008, 05:52 PM
The svn version of mobi2oeb in libprs500 works on it just fine.

02-24-2008, 05:59 PM
Look forward to the next version.

02-25-2008, 10:40 AM
Thanks Kovid!!!

Between this program, and BD, my Sony Reader will handle almost all my needs!!

(Well, full size PDF's, and lack of index-jumps for reference materials -- but hey, can't have everything!)

05-19-2008, 02:30 PM

Maybe I am doing something wrong, but the LRF ebook resulting from the conversion of the mobi book doesn't have most (if not all) of the images in the original mobipocket ebook.

I am using calibre to do the conversion and then sony's connect to transfer the ebook to my prs 500. Am I doing something wrong or are the images not supported yet?

P.S. I used a free ebook by mobipocket website.

Best Regards


05-19-2008, 03:14 PM
images are most definitely supported, there's probably something weird about that file, i'll take a look it.

05-19-2008, 03:22 PM
Thank you for your quick reply.

I tried some stuff since my first post. If I use mobi2html and then html2lrf, the resulting lrf does contain the images.

05-19-2008, 03:36 PM
yeah there's a bug in the image extraction code of mobi2oeb, it's already been fixed. The fix will be in the next release of calibre.

06-20-2008, 11:13 AM
Quick question for mobi conversions. I have converted .prc files just fine from mobipocket now will secure mobipocket convert as easily? Or can I expect to encounter a DRM stripping requirement? I know for the 505 .lit files are the preferred format for conversion but not all the books I am looking at are in MS Reader format.

06-20-2008, 11:54 AM
will secure mobipocket convert as easily? Use mobidedrm, see DarkReverser's WebLog ( (look at its most recent comments).

06-20-2008, 12:01 PM
you have to strip DRM from secure mobi, calibre wont do it for you

02-14-2010, 11:22 AM
How do I install it on my nexus one? My files are .prc and i cant read them.