View Full Version : Original Lit2sb perl script RESURRECTED!


nrapallo
08-23-2008, 11:55 AM
I've found using the Lit2sb program (http://www.mobileread.com/forums/showthread.php?t=20592) very rewarding over the last few years. It has been a 'work horse' program accepting almost everything thrown at it and producing elegant .imp ebooks!

That said, there are some quirks that I've come to live with, namely: 8.3 filename processing, o_sb.imp output filename, uncontrollable margins (and other CSS settings), ...

I've always wanted to re-compile the program to do the things that I wanted it to do, but have been thwarted until just recently.

That's right, I've managed to resurrect the perl script it was written in (and compiled into a .exe by ActiveState's perl2exe and further obfuscated by upx compression). Unfortunately all comments seem to have been stripped in the original compilation process.

The perl script was written by reblibrarian (Philippe Rigaux of ebooksfrance.com) as evident in this posting in the REB1200 Yahoo group RE: [REB1200] Lit2SB source code

When I written lit2sb, it was only intended to automate the conversion of
.lit files, I mean that lit2sb don’t do any html conversion. In fact you
should see it more as a batch file written in perl…

So for your remarqs:

1) ??
2) I don’t touch the source html (I only add margins)
3) Lit2sb don’t add any line breaks, probably the gemstar publisher do
that or the ms$reader ignore those?

If you know perl I can send you a copy of the source script but the script
perl is compiled for the convenience of end users…

Phil

I have re-compiled a windows executable (Lit2sb.exe) based on a modified copy of that perl script to allow proper conversions. Just replace the original lit2sb.exe executable with the one in the below .zip file. Of course, do so after following the instructions previously given Convert .lit directly into .IMP formats (http://www.mobileread.com/forums/showthread.php?t=20592).

Among the things fixed were:
- uses source .lit filename as final .imp output filename and places resulting .imp in the same directory as the .lit source.
- for resulting .imp and .opf, no longer uses 8.3 filenames.
- uses "2%" left and right margins now, instead of "18pt"
- properly scales GEB1150/EBW1150 cover image so as to avoid bottom margin bleeding.
- fixed system calls to external programs to properly prefix path.

TO DO:
- make a GUI ala Mobi2IMP. The program will be called Lit2IMP!
- for REB1200 and EBW1150, rescale all images referred to in the .html ebook so that there is no bottom margin bleeding.
- fix the auto TOC entry insertion which usually duplicates the last entry in the <spine> section of the .opf.
- add any user requested (simple) modifications... Have any?

As always, enjoy!

RWood
08-23-2008, 04:15 PM
Great work Nick. A real asset for our toolbag.

nrapallo
08-23-2008, 04:35 PM
Great work Nick. A real asset for our toolbag.

Thanks, but just don't expect me to code Lit2lrf, Lit2mobi, Lit2rb, Lit2epub, etc. from this anytime soon... :p

I've already placed a lot of concurrent coding/experiments on my plate, though, this is exactly what I predicted when I start posting here on mobileread.com. See my bold predictions at the bottom of this message (http://www.mobileread.com/forums/showthread.php?p=150316#post150316) in Feb 2008!

zelda_pinwheel
08-23-2008, 06:23 PM
nick, you continue to amaze me !! thanks for yet another great contribution ! with your help our conversions to imp format are getting better and better (and easier !!). i've made this thread a sticky so people can easily find it.

nrapallo
08-23-2008, 08:16 PM
nick, you continue to amaze me !! thanks for yet another great contribution ! with your help our conversions to imp format are getting better and better (and easier !!). i've made this thread a sticky so people can easily find it.

Thanks ZP!

Wow, home page coverage and now a sticky; you know how to make a guy feel welcomed! :2thumbsup

So welcomed, that I'm afraid I'll never leave this place. :thumbsup:

zelda_pinwheel
08-23-2008, 08:19 PM
So welcomed, that I'm afraid I'll never leave this place. :thumbsup:

oh good, our cunning plan is working... :fedora: ;)

tautas
07-09-2010, 10:17 AM
Thanks nrapallo