View Full Version : Errors in .Lit files


shousa
01-29-2008, 05:08 AM
Using wordpad I have found a way to quickly "repair" a badly made (as far as I can see) .Lit ebook I bought for over $10 (I have 2 others with the same problem but all the rest, the vast majority, are fine)

Why I thought it needed repairing:
- book designer and lit2lrf would both only generate the first few pages and then stop without an error message.

In a nutshell here is the situation:
- exploded .lit to all it parts (a number of .jpg, html files and 1 opf and i css file and 1 .htm for the cover)
- found that all links (I mean 100%) referred to a .html called XXXfront.html when it should have been XXX.html. So clicking on the links in the html always came back to the xxxfront.html which is a single page with publisher details only.
- i used a find and replace in wordpad to change all the xxxfront.html links to xxx.html and now all the links 100%work....great so far.

My initial thoughts were to:
1) convert the exploded .Lit back to a .Lit for conversion to correct .Lrf
2) or.....convert the exploded files to .Lrf

but I could not find a way to do either.

Am working using Book designer to fix this now - anyone else encountered this?

shousa
01-29-2008, 05:18 AM
Have used mobicreator which confirms that the original exploded .lit had a massive number of unresolved links but my new version was error free.

Have made a .prc, now looking to convert the .prc to .rtf or something.

Installing converter now
http://www.processtext.com/abcpalm.html

If this pans out it is an easy fix for links that are bad.

shousa
01-29-2008, 05:48 AM
Using the above tools it seems possible to explode a .Lit then edit the .html files then convert to a single .prc then convert back to a .Lit.

The fixed .Lit could then be changed to a .Lrf.

Or could change the .prc to a .rtf - Trying it now.....oops that was a mess!

kovidgoyal
01-29-2008, 06:17 AM
Just run html2lrf --use-spine on any html file from the .lit file.

shousa
01-29-2008, 10:24 AM
Just run html2lrf --use-spine on any html file from the .lit file.

Damn that totally worked. :thanks: I now have all 3 books of the History of the decline of the roman empire as .Lrfs - all links, using the find and replace method, now work fine.

They take over 1 hour to load each though (pictures and hundreds of links) using the Lrf viewer.

I chose the Sony Reader for one reason Kovid (over the others) - your support tools are awesome.

Seeing as how that worked with multiple .html files I was wondering whether a website downloaded using HTTrack could be converted to a .Lrf the same way?

I will give it a go anyway!! What fun!! This conversion stuff is generally much faster than ripping CDs!!

kovidgoyal
01-29-2008, 03:06 PM
look at web2disk and web2lrf

JSWolf
01-29-2008, 03:37 PM
Just run html2lrf --use-spine on any html file from the .lit file.
I took a LIT file, expandedit to it's component parts and when I used html2lrf to convert to LRF I ended up with an LRF with no paragraph indents. Any way to sort this so the indents work?

If I convert the unexpanded LIT file, I did get the proper indents.

The command I used was...

html2lrf --use-spine --left-margin=0 --right-margin=0 --top-margin=0 --bottom-margin=0 --base-font-size=10 --wordspace=1 contents.html

The only command difference is lit2lrf and no --use-spine.

kovidgoyal
01-29-2008, 03:47 PM
Wow that's strange. lit2lrf basically explodes the lit file and calls html2lrf with the --use-spine option (and any options you pass to lit2lrf). It's probably got something to do with not finding the CSS file. Attach this lit file here.

JSWolf
01-29-2008, 04:49 PM
Wow that's strange. lit2lrf basically explodes the lit file and calls html2lrf with the --use-spine option (and any options you pass to lit2lrf). It's probably got something to do with not finding the CSS file. Attach this lit file here.
I'll create a ticket and post it on your site.

JSWolf
01-29-2008, 05:16 PM
Ticket #497 created and the LIT attached.

Using version 0.4.34.

shousa
01-29-2008, 07:26 PM
Hey JSWolf, have you tried using a .bat file rather than typing it in?

I call it ExplodedLit2Lrf (ExLit2Lrf.bat)

No need to use commandline - just right-click attached .bat file to choose edit then save.

Can double-click from Windows to run.

(finally I have done something worth a tiny bit of karma?)

JSWolf
01-29-2008, 07:53 PM
Hey JSWolf, have you tried using a .bat file rather than typing it in?

I call it ExplodedLit2Lrf (ExLit2Lrf.bat)

No need to use commandline - just right-click attached .bat file to choose edit then save.

Can double-click from Windows to run.

(finally I have done something worth a tiny bit of karma?)

Actually, I think it should be....

html2lrf --use-spine --left-margin=0 --right-margin=0 --top-margin=0 --bottom-margin=0 --base-font-size=10 --wordspace=1 %1

That way, you can put in the name of the file given that it can be different. Now, that would work very well if in fact it actually worked. The problem is that I don't get paragraph indents. But, your idea for the bat file is a good one to use for lit2lrf especially since I do tent to use the same options.

In this case, the code would be...

lit2lrf --left-margin=0 --right-margin=0 --top-margin=0 --bottom-margin=0 --base-font-size=10 --wordspace=1 %1

JSWolf
01-29-2008, 07:59 PM
I just remembered another bug with lit2lrf. It doesn't put the ToC in the actual eBook. All you get is the inline ToC. And sometimes they way the ToC is done, it's nice to have it in the actual eBook.

Ticket #498 created.

JSWolf
01-29-2008, 08:13 PM
The indent problem I think I just figured out....

.para {
display: block;
margin-bottom: 0%;
text-indent:5%;
}

html2lrf is not respecting the 5%.

But if I replace the 5% with 20px, it works.

.para {
display: block;
margin-bottom: 0%;
text-indent:20px;
}

shousa
01-29-2008, 08:34 PM
Great JSWolf!

By the way using your options fixed my .lrfs so now they load in a few seconds!

Thanks:thanks:

shousa
01-29-2008, 08:42 PM
I just remembered another bug with lit2lrf. It doesn't put the ToC in the actual eBook. All you get is the inline ToC. And sometimes they way the ToC is done, it's nice to have it in the actual eBook.

Ticket #498 created.

I agree. I am going to explode all my .lits and use the batch file to convert. They load faster.

BTW I would rather edit the batch file by copying the file name (right-click the .html to rename and then control V to copy the text and then control c to paste it into the batch file- easier than entering I think)

HarryT
01-30-2008, 09:29 AM
BTW I would rather edit the batch file by copying the file name (right-click the .html to rename and then control V to copy the text and then control c to paste it into the batch file- easier than entering I think)

Other way around, just to avoid any confusion - ^C = copy, ^V = paste

igorsk
01-30-2008, 09:38 AM
Just drag and drop the file onto the .bat and %1 will be replaced by its full path, just as if the batch file was called with a parameter. Although it's probably better to put %1 in quotes, in case the file path has embedded spaces.