![]() |
#646 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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. |
![]() |
![]() |
![]() |
#647 | |
GuteBook/Mobi2IMP Creator
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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:
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"; } ![]() |
|
![]() |
![]() |
![]() |
#648 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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 |
![]() |
![]() |
![]() |
#649 |
Junior Member
![]() Posts: 8
Karma: 10
Join Date: Jan 2009
Device: Kindle
|
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! |
![]() |
![]() |
![]() |
#650 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,452
Karma: 7185064
Join Date: Oct 2007
Location: Linköpng, Sweden
Device: Kindle Voyage, Nexus 5, Kindle PW
|
Quote:
Code:
find . -name "*.lit" -exec lit2mobi \{\} \; Also notice that lit2mobi have some (undocumented, read the source) flags to fix strange html code in a lit file. |
|
![]() |
![]() |
![]() |
#651 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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.
|
![]() |
![]() |
![]() |
#652 | |
GuteBook/Mobi2IMP Creator
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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:
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 |
|
![]() |
![]() |
![]() |
#653 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,452
Karma: 7185064
Join Date: Oct 2007
Location: Linköpng, Sweden
Device: Kindle Voyage, Nexus 5, Kindle PW
|
Quote:
|
|
![]() |
![]() |
![]() |
#654 |
The Grand Mouse 高貴的老鼠
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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? |
![]() |
![]() |
![]() |
#655 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,452
Karma: 7185064
Join Date: Oct 2007
Location: Linköpng, Sweden
Device: Kindle Voyage, Nexus 5, Kindle PW
|
Quote:
|
|
![]() |
![]() |
![]() |
#656 | |
The Grand Mouse 高貴的老鼠
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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:
|
|
![]() |
![]() |
![]() |
#657 |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,549
Karma: 19500001
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
|
![]() |
![]() |
![]() |
#658 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,452
Karma: 7185064
Join Date: Oct 2007
Location: Linköpng, Sweden
Device: Kindle Voyage, Nexus 5, Kindle PW
|
Quote:
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. |
|
![]() |
![]() |
![]() |
#659 |
The Grand Mouse 高貴的老鼠
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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.
|
![]() |
![]() |
![]() |
#660 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,364
Karma: 27230406
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Actually, if you move them and something breaks, that will be an excellent way to figure out more about the format.
|
![]() |
![]() |
![]() |
Tags |
mobi2mobi, mobils |
|
![]() |
||||
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 |