![]() |
#1 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,452
Karma: 7185064
Join Date: Oct 2007
Location: Linköpng, Sweden
Device: Kindle Voyage, Nexus 5, Kindle PW
|
lit2mobi written in Perl working
I am working on a set of programs to convert to Mobipocket format. I have only worked on it a couple of days so the state of the code is alpha. I am a bit unsure if the mobi file is generated entirely correct but it seems to works on my Gen3.
If somebody would like to start using these program you need some familiarity with Perl and you need to know how to install modules from CPAN. I have tested on Linux and it should work on Mac and it might work with some small changes on Windows. Notice that the Perl programs writes the Mobifile so you do not have to run mobigen using wine or other similar programs. You have to have clit installed for lit2mobi to work. If you do not want to install the program but would like to see the result you can send me a lit file and I will send you back the result so you could help by giving feedback on the result. The programs are here: http://www.ida.liu.se/~tompe/mobiperl/mobiperl-0.02.tar You run it like: Code:
lit2mobi The_Railway_Children.lit lit2mobi --coverimage cover.jpg file.lit Code:
perldoc html2mobi I place the TOC in the beginning of the file also. I also search for a suitable cover image and use it automatically. I do not add a reference to the cover image and that seems to lead to that the book opens on the TOC page and if you go back one page you get the full cover image. If you have a reference you get two cover images instead. Feedback (bug report, feature suggestions and so on) is very welcome |
![]() |
![]() |
![]() |
#2 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,156
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
You should use the spine element of the OPF file if present to fix the order in which the HTML files are appended.
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,452
Karma: 7185064
Join Date: Oct 2007
Location: Linköpng, Sweden
Device: Kindle Voyage, Nexus 5, Kindle PW
|
I do that. But I duplicate the TOC and place a copy of it first since I have not gotten the guide stuff to work yet. It was an experiment but also it might be that on the Gen3 you want to have it that way. And yes since I only tested a couple of lit files and the TOC was always at the end I assumed that was the standard...
|
![]() |
![]() |
![]() |
#4 | |
Sir Penguin of Edinburgh
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,375
Karma: 23555235
Join Date: Apr 2007
Location: DC Metro area
Device: Shake a stick plus 1
|
Quote:
|
|
![]() |
![]() |
![]() |
#5 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,156
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
The way the TOC is specified varies widely from lit file to lit file. Take a look at opf.py in libprs500 for the logic I use to figure out the TOC.
You might also find this page useful http://www.idpf.org/oebps/oebps1.2/d...eb12-xhtml.htm Last edited by kovidgoyal; 11-28-2007 at 04:52 PM. |
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,452
Karma: 7185064
Join Date: Oct 2007
Location: Linköpng, Sweden
Device: Kindle Voyage, Nexus 5, Kindle PW
|
Well I think it is the right placement for devices were the TOC-button works fast. The Mobipoacket demo book also had the TOC at the end. But I will look at more test cases.
|
![]() |
![]() |
![]() |
#7 |
Groupie
![]() ![]() ![]() ![]() ![]() Posts: 176
Karma: 406
Join Date: Jan 2008
Device: Amazon Kindle 2, Amazon Kindle, Sony PRS-505
|
Thanks pal, it works great! I am wondering if you could add a batch process mode? It would be even better if it could recursively go through all sub-directory.
Thanks again. |
![]() |
![]() |
![]() |
#8 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,452
Karma: 7185064
Join Date: Oct 2007
Location: Linköpng, Sweden
Device: Kindle Voyage, Nexus 5, Kindle PW
|
Well, maybe. I put it on my list of possible things to do. It is easy to write a script to do this so I am not sure that these kind of things should be built in.
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Scariest Books Ever Written | MV64 | Reading Recommendations | 58 | 01-25-2013 03:11 PM |
Perl and Regex | Alexander Turcic | Lounge | 3 | 01-25-2011 07:48 PM |
This seems like a story wanting to be written | kennyc | Writers' Corner | 3 | 12-26-2009 11:55 PM |
MobiPerl: LIT2MOBI page breaks don't work | =X= | Kindle Formats | 7 | 11-13-2008 11:08 AM |
html2mobi (a mobigen replacement written in Perl) | tompe | Kindle Formats | 89 | 02-12-2008 12:33 PM |