Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > Kindle Formats

Notices

Reply
 
Thread Tools Search this Thread
Old 01-03-2009, 09:39 PM   #646
tompe
Grand Sorcerer
tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.
 
Posts: 7,452
Karma: 7185064
Join Date: Oct 2007
Location: Linköpng, Sweden
Device: Kindle Voyage, Nexus 5, Kindle PW
OK, I see the problem now. The prc file does not contain HTML code and I think the MobiPocket format requires HTML code. And if you do mobi2html followed by html2mobi you loose the formatting.

So I think the mistake was to generate files of type TEXt with the content as ordinary text.

This is the same problem as for the file in the other thread.

My lit2mobi can of course be used in a batch job.
tompe is offline   Reply With Quote
Old 01-03-2009, 10:48 PM   #647
nrapallo
GuteBook/Mobi2IMP Creator
nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.
 
nrapallo's Avatar
 
Posts: 2,958
Karma: 2530691
Join Date: Dec 2007
Location: Toronto, Canada
Device: REB1200 EBW1150 Device: T1 NSTG iLiad_v2 NC Device: Asus_TF Next1 WPDN
Quote:
Originally Posted by tompe View Post
OK, I see the problem now. The prc file does not contain HTML code and I think the MobiPocket format requires HTML code. And if you do mobi2html followed by html2mobi you loose the formatting.

So I think the mistake was to generate files of type TEXt with the content as ordinary text.

This is the same problem as for the file in the other thread.

My lit2mobi can of course be used in a batch job.
My Mobi2IMP can handle that TEXt/REAd .prc because I included a simple detection for text files (in bold) as follows:
Code:
my $text = $pdb->text;

if (defined $opt_rawhtml) {
    binmode (STDOUT);
    print $text;
}
if (substr ($text, 0, 6) ne "<html>" && substr ($text, 0, 6) ne "<HTML>" ) {                                       
    open TEMPFILE, ">$explodedir/$htmlfile.txt" or die "Cannot create .txt file";
    binmode (TEMPFILE);
    print TEMPFILE $text;
    close TEMPFILE;

    open TEMPFILE, "$explodedir/$htmlfile.txt" or die "Cannot open .txt file";
    my @lines = <TEMPFILE>;               # Read it into an array
    close TEMPFILE;                       # Close the file

    #unlink "$explodedir/$htmlfile.txt";

    $text = "<HTML><HEAD></HEAD>\n<BODY>\n" ;

    my $line;
    foreach $line (@lines) {              # assign @lines to $line, one at a time
       $text .= "<P>" . $line . "</P>" unless (length($line) == 1);  
    }

    $text .= "\n</BODY>\n</HTML>\n";

}
nrapallo is offline   Reply With Quote
Old 01-04-2009, 12:04 AM   #648
tompe
Grand Sorcerer
tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.
 
Posts: 7,452
Karma: 7185064
Join Date: Oct 2007
Location: Linköpng, Sweden
Device: Kindle Voyage, Nexus 5, Kindle PW
Yes, it would be possible to build a txt2mobi command that do something like this. But in mobi2mobi I did not want to touch the content data at all.

But a better approach seems to be to use some external program like

http://txt2html.sourceforge.net/

to make a html file from a text file and then run mobigen or html2mobi on the html file.

Here is a Windows program for converting text to html:

http://www.softpedia.com/get/Interne...onverter.shtml
tompe is offline   Reply With Quote
Old 01-04-2009, 12:08 AM   #649
Dr Dave
Junior Member
Dr Dave began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Jan 2009
Device: Kindle
Quote:
Originally Posted by tompe View Post

My lit2mobi can of course be used in a batch job.
Can you provide a batch script? I have seen examples of how to do it with titles that are all one "word", but the overwhelming majority of mine are multiple words and I can't seem to get a script generated to handle all of them in a given directory.

Thanx again!
Dr Dave is offline   Reply With Quote
Old 01-04-2009, 12:15 AM   #650
tompe
Grand Sorcerer
tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.
 
Posts: 7,452
Karma: 7185064
Join Date: Oct 2007
Location: Linköpng, Sweden
Device: Kindle Voyage, Nexus 5, Kindle PW
Quote:
Originally Posted by Dr Dave View Post
Can you provide a batch script? I have seen examples of how to do it with titles that are all one "word", but the overwhelming majority of mine are multiple words and I can't seem to get a script generated to handle all of them in a given directory.
That I have to let somebody that know Windows answer. In Unix I would do:
Code:
find . -name "*.lit" -exec lit2mobi \{\} \;
and I suppose this would work in Windows in a Cygwin shell.

Also notice that lit2mobi have some (undocumented, read the source) flags to fix strange html code in a lit file.
tompe is offline   Reply With Quote
Old 01-07-2009, 09:12 PM   #651
tompe
Grand Sorcerer
tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.
 
Posts: 7,452
Karma: 7185064
Join Date: Oct 2007
Location: Linköpng, Sweden
Device: Kindle Voyage, Nexus 5, Kindle PW
I did check in the fix for multibyte character overlap discussed in another thread. I till have an offset of one for file position using mobi2html on files using multibyte character overlap.
tompe is offline   Reply With Quote
Old 01-07-2009, 10:28 PM   #652
nrapallo
GuteBook/Mobi2IMP Creator
nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.
 
nrapallo's Avatar
 
Posts: 2,958
Karma: 2530691
Join Date: Dec 2007
Location: Toronto, Canada
Device: REB1200 EBW1150 Device: T1 NSTG iLiad_v2 NC Device: Asus_TF Next1 WPDN
Quote:
Originally Posted by tompe View Post
I did check in the fix for multibyte character overlap discussed in another thread. I till have an offset of one for file position using mobi2html on files using multibyte character overlap.
I incorporated those changes into my Mobi2IMP and now the Feedbooks.com ebook, Rosenbaum - The Ant King and Other Stories.mobi, discussed here properly decodes and creates valid links to all filepos positions.

Great debugging!

EDIT: 8-Jan-2009 added results from beta Mobi2IMP as well as beta Mobi2IMP.pl for your review.

Last edited by nrapallo; 01-08-2009 at 08:32 AM. Reason: added results from beta Mobi2IMP as well as beta Mobi2IMP.pl
nrapallo is offline   Reply With Quote
Old 01-08-2009, 06:33 AM   #653
tompe
Grand Sorcerer
tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.
 
Posts: 7,452
Karma: 7185064
Join Date: Oct 2007
Location: Linköpng, Sweden
Device: Kindle Voyage, Nexus 5, Kindle PW
Quote:
Originally Posted by nrapallo View Post
I incorporated those changes into my Mobi2IMP and now the Feedbooks.com ebook, Rosenbaum - The Ant King and Other Stories.mobi, discussed here properly decodes and creates valid links to all filepos positions.
You do not get filepos pointing to the position before "<"? I got warnings for that but it seems to be off by one only.
tompe is offline   Reply With Quote
Old 01-21-2009, 07:37 AM   #654
pdurrant
The Grand Mouse 高貴的老鼠
pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.
 
pdurrant's Avatar
 
Posts: 73,964
Karma: 315160596
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle Oasis
Images in Mobipocket files:

I recently came across a problem with Calibre's import on Mobipocket files.
http://calibre.kovidgoyal.net/ticket/1645

Kovid says the problem was that mobi2mobi can create non-sequential image records. That is, there can be some non-image records between the first image in the file (pointed to in the header) and the last image.

I'm not sure this is a bug myself, although if Mobipocket itself doesn't create files with images mixed in with non image data, perhaps mobi2mobi shouldn't either.

The real problem is, I can't see a clean way to fix the issue. Any ideas?
pdurrant is offline   Reply With Quote
Old 01-22-2009, 07:22 PM   #655
tompe
Grand Sorcerer
tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.
 
Posts: 7,452
Karma: 7185064
Join Date: Oct 2007
Location: Linköpng, Sweden
Device: Kindle Voyage, Nexus 5, Kindle PW
Quote:
Originally Posted by pdurrant View Post
Images in Mobipocket files:

I recently came across a problem with Calibre's import on Mobipocket files.
http://calibre.kovidgoyal.net/ticket/1645

Kovid says the problem was that mobi2mobi can create non-sequential image records. That is, there can be some non-image records between the first image in the file (pointed to in the header) and the last image.

I'm not sure this is a bug myself, although if Mobipocket itself doesn't create files with images mixed in with non image data, perhaps mobi2mobi shouldn't either.

The real problem is, I can't see a clean way to fix the issue. Any ideas?
I do not get what the problem is. I thought that all records after the text is images. As I recall adding a thumb nail will add a new record and set the pointer. Why should this be wrong? Since we do not have a spec we can not know that it is wrong. Does some debugged code fails to handle this?
tompe is offline   Reply With Quote
Old 01-23-2009, 04:28 AM   #656
pdurrant
The Grand Mouse 高貴的老鼠
pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.
 
pdurrant's Avatar
 
Posts: 73,964
Karma: 315160596
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle Oasis
It seems that there can be some non-image records after the image records. So then adding more images results in the images not all being in consecutive records.

As you say, we don't have a spec for Mobipocket, but since Mobipocket Creator always put images in consecutive records, I can see Kovid's point.

However, since he's going to change Calibre to work with non-consecutive images , I don't think a change in MobiPerl is necessary (or perhaps even possible). I just wanted to find out what other people thought.

Quote:
Originally Posted by tompe View Post
I do not get what the problem is. I thought that all records after the text is images. As I recall adding a thumb nail will add a new record and set the pointer. Why should this be wrong? Since we do not have a spec we can not know that it is wrong. Does some debugged code fails to handle this?
pdurrant is offline   Reply With Quote
Old 01-23-2009, 04:33 AM   #657
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 7,549
Karma: 19500001
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Quote:
Originally Posted by pdurrant View Post
As you say, we don't have a spec for Mobipocket, but since Mobipocket Creator always put images in consecutive records, I can see Kovid's point.
But all other mobipocket readers read those mobiperl-created files without problems, don't they?
Jellby is offline   Reply With Quote
Old 01-23-2009, 05:03 AM   #658
tompe
Grand Sorcerer
tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.
 
Posts: 7,452
Karma: 7185064
Join Date: Oct 2007
Location: Linköpng, Sweden
Device: Kindle Voyage, Nexus 5, Kindle PW
Quote:
Originally Posted by Jellby View Post
But all other mobipocket readers read those mobiperl-created files without problems, don't they?
I thought so. It would be interesting to know if this is not the case.

It is no problem to put them in another order but since I do not know if the meta data contains any pointer to the non image records I on purpose made sure that mobi2mobi did not change anything in the data records.
tompe is offline   Reply With Quote
Old 01-23-2009, 07:40 AM   #659
pdurrant
The Grand Mouse 高貴的老鼠
pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.
 
pdurrant's Avatar
 
Posts: 73,964
Karma: 315160596
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle Oasis
This is why I said I couldn't see any clean way to fix the 'problem'. We can't move any records because, as you say, we don't know what other data might expect them to be just where they are.



Quote:
Originally Posted by tompe View Post
It is no problem to put them in another order but since I do not know if the meta data contains any pointer to the non image records I on purpose made sure that mobi2mobi did not change anything in the data records.
pdurrant is offline   Reply With Quote
Old 01-23-2009, 01:10 PM   #660
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,364
Karma: 27230406
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Quote:
Originally Posted by pdurrant View Post
This is why I said I couldn't see any clean way to fix the 'problem'. We can't move any records because, as you say, we don't know what other data might expect them to be just where they are.
Actually, if you move them and something breaks, that will be an excellent way to figure out more about the format.
kovidgoyal is offline   Reply With Quote
Reply

Tags
mobi2mobi, mobils


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mobi2Mobi Mobi2Mobi v0.13 - GUI for Mobiperl tools Jad Kindle Formats 476 03-15-2015 05:51 PM
Tools for Editing Kindle .mobi Files? GJN Kindle Formats 33 12-26-2013 02:05 PM
Handy Perl Script to convert HTML0 files to smartquotes maggotb0y Sony Reader 0 04-12-2007 11:49 AM
PRS-500 Perl tools to generate Reader content TadW Sony Reader Dev Corner 0 01-08-2007 05:55 AM
gmail copy (gmcp) - Perl script to copy files to/from Gmail Colin Dunstan Lounge 0 09-04-2004 01:24 PM


All times are GMT -4. The time now is 02:57 PM.


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