Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 12-18-2008, 07:45 PM   #1
llasram
Reticulator of Tharn
llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.
 
llasram's Avatar
 
Posts: 618
Karma: 400000
Join Date: Jan 2007
Location: EST
Device: Sony PRS-505
LIT output

Hot off the digital presses, Kovid has just released calibre version 0.4.117, which integrates my LIT-generation support. For now, LIT-generation is available only on the command-line. For your command-lining pleasure, calibre provides two new tools: 'any2lit', which works basically like 'any2epub' and will convert just about anything to a LIT e-book; and 'oeb2lit', which more-or-less directly encapsulates OEBPS 1.x or 2.0 content into an OEBPS 1.x LIT e-book.

The tools have most of the features you would expect, and have the following shortcomings you might not:
  • We still don't know the LIT anchor-hashing algorithm. Some links in books with more than six anchors per "page" (if using any2lit) or per HTML file (if using oeb2lit) will not work.
  • CSS and markup is not yet transformed to the subset MSReader understands. The subset MSReader supports is somewhat idiosyncratic, and a future release will transform content written to deform gracefully into content which deforms gracefully.

Let us know of any improvements you'd like to see, and happy converting!

(P.S. to a moderator -- perhaps this should be made sticky?)
llasram is offline   Reply With Quote
Old 12-18-2008, 09:04 PM   #2
=X=
Wizard
=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.
 
=X='s Avatar
 
Posts: 3,671
Karma: 12205348
Join Date: Mar 2008
Device: Galaxy S, Nook w/CM7
llsram, Great news! I'm glad LIT support made it into calibre.

Anyhow I've already got to do some testing. I've created two LIT files one for MOBI and one from HTML. The MOBI causes MSReader to crash and the HTML version creates a blank LIT file.

I've attached the LIT files, MOBI file, the HTML file, and the command line used to create the LIT from HTML file.

=X=
Attached Files
File Type: zip LITFILE.zip (803.6 KB, 699 views)
=X= is offline   Reply With Quote
Advert
Old 12-18-2008, 09:55 PM   #3
llasram
Reticulator of Tharn
llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.
 
llasram's Avatar
 
Posts: 618
Karma: 400000
Join Date: Jan 2007
Location: EST
Device: Sony PRS-505
Quote:
Originally Posted by =X= View Post
Anyhow I've already got to do some testing. I've created two LIT files one for MOBI and one from HTML. The MOBI causes MSReader to crash and the HTML version creates a blank LIT file.
Nooooooooooo... After all the fighting to get the LZX compression code building on Windows, it appears that "building" is not the same as "working."

Ok, so another short-coming -- does not yet work on Windows.

To keep you interested while I track down the problem, attached is what the "any2lit" converted Mobipocket book is supposed to look like.
Attached Files
File Type: zip Return_of_Tarzan.zip (236.3 KB, 675 views)
llasram is offline   Reply With Quote
Old 12-18-2008, 11:19 PM   #4
llasram
Reticulator of Tharn
llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.
 
llasram's Avatar
 
Posts: 618
Karma: 400000
Join Date: Jan 2007
Location: EST
Device: Sony PRS-505
Quote:
Originally Posted by llasram View Post
Ok, so another short-coming -- does not yet work on Windows.
As it turns out, Windows is not a big-endian platform. Who knew? I've pushed a fix to Kovid, so it should hopefully end up in the next release. Apologies for the wait...
llasram is offline   Reply With Quote
Old 12-19-2008, 12:14 AM   #5
=X=
Wizard
=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.
 
=X='s Avatar
 
Posts: 3,671
Karma: 12205348
Join Date: Mar 2008
Device: Galaxy S, Nook w/CM7
Quote:
Originally Posted by llasram View Post
As it turns out, Windows is not a big-endian platform. Who knew? I've pushed a fix to Kovid, so it should hopefully end up in the next release. Apologies for the wait...
Big-endian/little-endian is processor specific not OS. Chances are your going to run into little/big endian issues on Linux as well.

BTW I took a look at the LIT file you posted. It looks like the links do not work on the LIT file. I checked the MOBI and they do work. Also there are issues with the CSS. I suspect this is because you are converting to ePUB first then to LIT. ePUB uses CSS2 I don't know what version LIT supports, but CSS2 is stricter than CSS1. (Note the CSS problem is caused because CSS2 does not allow styles to start with a number, where this was valid in CSS1)

=X=
=X= is offline   Reply With Quote
Advert
Old 12-19-2008, 02:16 AM   #6
llasram
Reticulator of Tharn
llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.
 
llasram's Avatar
 
Posts: 618
Karma: 400000
Join Date: Jan 2007
Location: EST
Device: Sony PRS-505
Quote:
Originally Posted by =X= View Post
Big-endian/little-endian is processor specific not OS. Chances are your going to run into little/big endian issues on Linux as well.
Er, yes. That was what passes for a joke in my tribe . There was a preprocessor check for big-endianess in the GPLed LZX compression code I appropriated. Unfortunately neither of the two preprocessor macros it compared are defined by the included set of headers under VC 2008, which meant the condition evaluated to "true".

Quote:
BTW I took a look at the LIT file you posted. It looks like the links do not work on the LIT file. I checked the MOBI and they do work.
That would be one of the two outstanding issues already mentioned. Until someone figures out the hashing algorithm MSReader uses, links into files with more than six anchors won't work. Any2lit splits the input at page boundaries, which improves matters somewhat, but the book in question still specifies more anchors than will work. I could go a step further in working around the problem by only indexing anchors which are actually the targets hyperlinks, but that's just another layer of complexity / slowness which won't be necessary once we figure out the algorithm.

Quote:
Also there are issues with the CSS. I suspect this is because you are converting to ePUB first then to LIT. ePUB uses CSS2 I don't know what version LIT supports, but CSS2 is stricter than CSS1. (Note the CSS problem is caused because CSS2 does not allow styles to start with a number, where this was valid in CSS1)
And that would be the other outstanding issue mentioned. Right now neither any2lit or oeb2lit do much of any style/markup pre-processing to produce something more palatable to MSReader. I've got some CSS "flattening" code which should get things most of the way there, but there are still some kinks I need to work out.
llasram is offline   Reply With Quote
Old 12-19-2008, 07:17 AM   #7
igorsk
Wizard
igorsk ought to be getting tired of karma fortunes by now.igorsk ought to be getting tired of karma fortunes by now.igorsk ought to be getting tired of karma fortunes by now.igorsk ought to be getting tired of karma fortunes by now.igorsk ought to be getting tired of karma fortunes by now.igorsk ought to be getting tired of karma fortunes by now.igorsk ought to be getting tired of karma fortunes by now.igorsk ought to be getting tired of karma fortunes by now.igorsk ought to be getting tired of karma fortunes by now.igorsk ought to be getting tired of karma fortunes by now.igorsk ought to be getting tired of karma fortunes by now.
 
Posts: 3,442
Karma: 300001
Join Date: Sep 2006
Location: Belgium
Device: PRS-500/505/700, Kindle, Cybook Gen3, Words Gear
You can detect endianness at runtime. Grabbed from some random page:
Code:
Uint32 Value32;
Uint8 *VPtr = (Uint8 *)&Value32;

VPtr[0] = VPtr[1] = VPtr[2] = 0; VPtr[3] = 1;

if(Value32 == 1)
   printf("I'm big endian\n");
else
   printf("I'm little endian\n");
igorsk is offline   Reply With Quote
Old 12-19-2008, 03:13 PM   #8
=X=
Wizard
=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.
 
=X='s Avatar
 
Posts: 3,671
Karma: 12205348
Join Date: Mar 2008
Device: Galaxy S, Nook w/CM7
Quote:
Originally Posted by llasram View Post
Er, yes. That was what passes for a joke in my tribe.
Ah well yes, it was late I see the sarcasm now .

Quote:
Originally Posted by llasram View Post
That would be one of the two outstanding issues .. .
My aplogoizes I did not mean to rehash known issues.


Quote:
Originally Posted by igorsk View Post
You can detect endianness at runtime. Grabbed from some random page:
Code:
Uint32 Value32;
Uint8 *VPtr = (Uint8 *)&Value32;

VPtr[0] = VPtr[1] = VPtr[2] = 0; VPtr[3] = 1;

if(Value32 == 1)
   printf("I'm big endian\n");
else
   printf("I'm little endian\n");
I use to be in favor of dong these checks in my code, but as systems are transitioning from 32 to 64 bit. It will complicate ones code w/o need. Its best to allow the OS to handle the edian/memory. Just make sure the macros work .

=X=
=X= is offline   Reply With Quote
Old 12-22-2008, 11:12 PM   #9
macthekitten
Enthusiast
macthekitten has a complete set of Star Wars action figures.macthekitten has a complete set of Star Wars action figures.macthekitten has a complete set of Star Wars action figures.
 
Posts: 31
Karma: 289
Join Date: Dec 2008
Location: Ontario Canada
Device: PRS700
yikes i'm scared to even ask a question

Someone emailed me a LIT file, can I use Calibre to convert it to something the Sony PRS 700 can read?
macthekitten is offline   Reply With Quote
Old 12-22-2008, 11:14 PM   #10
pilotbob
Grand Sorcerer
pilotbob ought to be getting tired of karma fortunes by now.pilotbob ought to be getting tired of karma fortunes by now.pilotbob ought to be getting tired of karma fortunes by now.pilotbob ought to be getting tired of karma fortunes by now.pilotbob ought to be getting tired of karma fortunes by now.pilotbob ought to be getting tired of karma fortunes by now.pilotbob ought to be getting tired of karma fortunes by now.pilotbob ought to be getting tired of karma fortunes by now.pilotbob ought to be getting tired of karma fortunes by now.pilotbob ought to be getting tired of karma fortunes by now.pilotbob ought to be getting tired of karma fortunes by now.
 
pilotbob's Avatar
 
Posts: 19,832
Karma: 11844413
Join Date: Jan 2007
Location: Tampa, FL USA
Device: Kindle Touch
Quote:
Originally Posted by macthekitten View Post
Someone emailed me a LIT file, can I use Calibre to convert it to something the Sony PRS 700 can read?
Yes. Assuming it is not DRM protected.

BOb
pilotbob is offline   Reply With Quote
Old 01-13-2009, 11:52 AM   #11
=X=
Wizard
=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.
 
=X='s Avatar
 
Posts: 3,671
Karma: 12205348
Join Date: Mar 2008
Device: Galaxy S, Nook w/CM7
Last night I integrated any2lit on BookCreator. I've noticed that the final LIT files are not utilizing the style sheet. And as a result do not format as expected.

I'm not sure if it's a result of LIT or the opf that is built, here is why.
As a test I also decompiled the LIT file and created a mobi file with mobigen using the opf file. And the mobi file also did not use the style sheets.

At this point I'll admit I have no clue what I'm talking about, I just know when I do the above step with properly formatted LIT or MOBI files using the opf file seems to generate the expected results.

Also again on the TOC topic. I know you mentioned you have no intention of adding the level of support that exist for any2lrf or any2epub, but can you add a switch option where the user can pass in their own HREF to a toc element in the opf file. That is how WordRMR handles it and it works for the most part and is a simple solution.

=X=
=X= is offline   Reply With Quote
Old 01-13-2009, 12:12 PM   #12
llasram
Reticulator of Tharn
llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.
 
llasram's Avatar
 
Posts: 618
Karma: 400000
Join Date: Jan 2007
Location: EST
Device: Sony PRS-505
Quote:
Originally Posted by =X= View Post
Also again on the TOC topic. I know you mentioned you have no intention of adding the level of support that exist for any2lrf or any2epub, but can you add a switch option where the user can pass in their own HREF to a toc element in the opf file. That is how WordRMR handles it and it works for the most part and is a simple solution.
Woah woah woah! I have every intention of adding the level of support which exists for any2lrf/any2epub. I'm just doing it kind of backwards... I pushed the current state to Kovid because I thought it would be useful to people to have *some* LIT-generation ability, but I see now that was a mistake. I'm almost done with Mobipocket generation, which I'm doing much more completely and I've implemented in a way which lets LIT and Mobipocket (and any other format) share everything which is common between. After that gets merged, I'm going to go back to LIT support and implement LIT-specific markup and CSS mangling, bringing it up to the level of the other supported formats.

As for your two specific issues -- MSReader should be picking up on an included stylesheet, with the caveat that MSReader doesn't support any contextual selectors. If you post one of the created LIT files I can hopefully figure out what's going on.

The TOC stuff I'm not 100% sure how to handle... If you generate your own OPF, then you can have a //guide/reference[@type="toc"] which MSReader will just pick up on. If you're letting any2* generate your OPF, I'm less sure... Kovid has been handling that layer, but I believe it just means adding an option to any2epub. I'll take a look at that this evening, as it would definitely be useful for Mobipocket support as well.
llasram is offline   Reply With Quote
Old 01-13-2009, 01:05 PM   #13
=X=
Wizard
=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.
 
=X='s Avatar
 
Posts: 3,671
Karma: 12205348
Join Date: Mar 2008
Device: Galaxy S, Nook w/CM7
@llasram; Sorry for that last post as I did not mean to say that you did not have any intention to produce quality LIT. I was in particularly referencing the creation of the TOC. In a previous exchange between you and I you mentioned you did not now how to handle the TOC and where not worried about it. Now I'm realizing you just meant to put it off until a solution came to mind.

I'd also like to reassure you it was not a mistake to release the LIT support prematurely. You mentioned it was in beta and I understand that. I just thought I was being helpful buy providing you some feedback. My apologized is I came off the wrong way. How does that saying go "The way to hell is paved with good intentions"

I've attached both the LIT file and the HTML file that was used to create the LIT

=X=
=X= is offline   Reply With Quote
Old 01-13-2009, 07:16 PM   #14
llasram
Reticulator of Tharn
llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.
 
llasram's Avatar
 
Posts: 618
Karma: 400000
Join Date: Jan 2007
Location: EST
Device: Sony PRS-505
Quote:
Originally Posted by =X= View Post
@llasram; Sorry for that last post as I did not mean to say that you did not have any intention to produce quality LIT.
And I'm sorry I was so touchy about it... I'm glad that you have found LIT generation useful though even as it is. So apologies all around, and now on with life .

The CSS issue... well, there are just so many ways something can go wrong. The CSS isn't being picked up in MSReader because I had a bug where I wasn't properly serializing relative URIs in LIT's compressed HTML format. If you extract the HTML then try to open it in a Web browser, the CSS wouldn't be picked up because I was switching the 'type' attribute of stylesheet-referencing <link/> tags to the OEBPS 1.x specific 'text/x-oeb1-css'. Then mobigen doesn't pick up the CSS because it can't handle (correctly!) URI-encoded filenames.

I've pushed fixes for the first two up to Kovid, but the mobigen issue is actually a bug in mobigen... You can report it to them, or just wait a few weeks for oeb2mobi/any2mobi .
llasram is offline   Reply With Quote
Old 01-14-2009, 02:29 AM   #15
=X=
Wizard
=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.
 
=X='s Avatar
 
Posts: 3,671
Karma: 12205348
Join Date: Mar 2008
Device: Galaxy S, Nook w/CM7
Quote:
Originally Posted by llasram View Post
I've pushed fixes for the first two up to Kovid, but the mobigen issue is actually a bug in mobigen...
Great, !
Quote:
Originally Posted by llasram View Post
You can report it to them, or just wait a few weeks for oeb2mobi/any2mobi .
You kidding, of course I'll wait, I'm confident by the time your done with any2mobi it will be a much better product than mobigen.

Thank you
=X=
=X= is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
LRF output kovidgoyal Calibre 873 04-06-2010 02:32 PM
FB2 output KarateMonkey Calibre 0 03-14-2010 07:47 PM
Trying to get consistent look to all output daveps Calibre 0 03-08-2010 02:18 PM
Converting LIT to LRF Woes (or: Trouble with Images in LIT Files) JEMelby Sony Reader 0 07-27-2007 09:18 PM
converting lit html output into one big file for BD Dave Berk Sony Reader 15 03-29-2007 10:02 PM


All times are GMT -4. The time now is 09:24 AM.


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