![]() |
#31 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,442
Karma: 300001
Join Date: Sep 2006
Location: Belgium
Device: PRS-500/505/700, Kindle, Cybook Gen3, Words Gear
|
dwSize is not a pointer. It's the size of MOBI header (EXTH immediately follows it so it looks like a pointer). For version 3 set it to 0x74. EXTH contains only metadata (and DRM ids) so it shouldn't matter if it's missing.
|
![]() |
![]() |
![]() |
#32 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,452
Karma: 7185064
Join Date: Oct 2007
Location: Linköpng, Sweden
Device: Kindle Voyage, Nexus 5, Kindle PW
|
Quote:
What is the difference between version 3 and 4 and why is it preferred to use version 3? |
|
![]() |
![]() |
Advert | |
|
![]() |
#33 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,442
Karma: 300001
Join Date: Sep 2006
Location: Belgium
Device: PRS-500/505/700, Kindle, Cybook Gen3, Words Gear
|
Version 4 adds support for DRMv2 (PID-based) and extents MOBI header to 0xD0 bytes. It's not that v3 is "preferred" but it should be enough for your purposes. Maybe Cybook's parser assumes header v4 and doesn't check the actual size. Since you say you get corrupted title, my guess is that it expects the extended title record to be present (in addition to the title at the beginning of the prc file). This extra info is specified by these fields:
Code:
44 Dword dwTitleOffset //from the start of record 0, codepage is dwCodepage 48 Dword dwTitleLength Code:
0 dd dwSignature //'EXTH' 4 dd dwSize //including everything 8 dd dwCount //count of extra data items extra item: 0 dd id 4 dd size 8 <size-8> data ids: 1: drm_server_id 2: drm_commerce_id 3: drm_ebookbase_book_id 100: Author 101: Publisher 102: Imprint 104: ISBN 105: Subject 106: PublishingDate 107: Review 108: Contributor 109: Rights 110: SubjectCode 111: Type 112: Source 113: ASIN 114: VersionNumber 115: Sample 116: StartReading 203: hasFakeCover |
![]() |
![]() |
![]() |
#34 |
Bit Wrangler
![]() ![]() ![]() ![]() ![]() Posts: 181
Karma: 415
Join Date: Oct 2007
Device: Sony PRS-505
|
been following along here...
|
![]() |
![]() |
![]() |
#35 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,442
Karma: 300001
Join Date: Sep 2006
Location: Belgium
Device: PRS-500/505/700, Kindle, Cybook Gen3, Words Gear
|
Well, 0x50 does include 0x40
![]() |
![]() |
![]() |
Advert | |
|
![]() |
#36 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,452
Karma: 7185064
Join Date: Oct 2007
Location: Linköpng, Sweden
Device: Kindle Voyage, Nexus 5, Kindle PW
|
Thanks a lot. I will add the extended header tonight and see if it works.
In the Alice mobi file dwTitleOffset is 0xFFFFFFFF so I assume that means that this title is not there. Where is this title usually placed? Is it in the MOBI header or after it? But using EXTH information seems more flexible so I might just go with that. Actually I had set the MOBI+0x70 flag to 0x50 whan I tested so that might explain why the Gen3 reader misbehaved when no extended header was available. |
![]() |
![]() |
![]() |
#37 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,442
Karma: 300001
Join Date: Sep 2006
Location: Belgium
Device: PRS-500/505/700, Kindle, Cybook Gen3, Words Gear
|
Extended title is somewhere after the EXTH header (it's not present in EXTH records btw). If not present, the one from the start of PRC is used (I think it's assumed to be in 1252 codepage).
|
![]() |
![]() |
![]() |
#38 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,452
Karma: 7185064
Join Date: Oct 2007
Location: Linköpng, Sweden
Device: Kindle Voyage, Nexus 5, Kindle PW
|
I am trying to parse the EXTH using the mobi file in the Alice in Wonderland example from Mobipockets web pages. It does not seem to follow your description exactly. The title string is in the block but what I get is:
Code:
EXTH doctype: EXTH EXTH length: 152 EXTH n_items: 7 ITEM: 64 16 - 100 22 - Carroll, Lewis ITEM: 6e 11 - 110 17 - FIC004000 ITEM: 69 10 - 105 16 - Classics ITEM: 12c 2e - 300 46 - ì¾ôíù ITEM: c9 c - 201 12 - ITEM: cb c - 203 12 - ITEM: ca c - 202 12 - |
![]() |
![]() |
![]() |
#39 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,442
Karma: 300001
Join Date: Sep 2006
Location: Belgium
Device: PRS-500/505/700, Kindle, Cybook Gen3, Words Gear
|
IDs 3xx and 2xx are binary fields. I don't know their purpose (yet?). As I said, you shouldn't worry about EXTH now, it shouldn't be necessary for your purpose.
Last edited by igorsk; 11-27-2007 at 11:08 AM. |
![]() |
![]() |
![]() |
#40 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,452
Karma: 7185064
Join Date: Oct 2007
Location: Linköpng, Sweden
Device: Kindle Voyage, Nexus 5, Kindle PW
|
Quote:
Maybe I should test just adding an author in EXTH. That might work... |
|
![]() |
![]() |
![]() |
#41 |
Bit Wrangler
![]() ![]() ![]() ![]() ![]() Posts: 181
Karma: 415
Join Date: Oct 2007
Device: Sony PRS-505
|
Igorsk, do you have a mobi v3 sample file? It looks like something is a bit different in v4 with regards to the EXTH...
-K |
![]() |
![]() |
![]() |
#42 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,452
Karma: 7185064
Join Date: Oct 2007
Location: Linköpng, Sweden
Device: Kindle Voyage, Nexus 5, Kindle PW
|
I missread a hextable. The title I saw was the extended title and when I added extended title I get correct display of title in the library. But when I open the file the Gen3 hangs or says that Multobook is not supported. So there probably is some remaining problem with the data in the header.
Well, some progress at least. Back to more testing... |
![]() |
![]() |
![]() |
#43 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,452
Karma: 7185064
Join Date: Oct 2007
Location: Linköpng, Sweden
Device: Kindle Voyage, Nexus 5, Kindle PW
|
It works! It seems that the Gen3 did not like images of size 600x800.
So here is the first release. The state of the code is very alpha. Please let me know if it does not work or if you find bugs or if you have suggestions for enhancements. I have tested with the Alice in Wonderland exemple from Mobipockets web site and I load it to my Gen3 and to my Palm T5 and read it. Here are the scripts: http://www.ida.liu.se/~tompe/mobiperl/mobiperl-0.01.tar Code:
perldoc -t html2mobi NAME html2mobi - A script to convert html files or an opf file to mobi SYNOPSIS html2mobi file.html html2mobi file1.html file2.html ... html2mobi file.opf DESCRIPTION A script to convert html files or an opf file to a mobi format file. OPTIONS --title TITLE Specify the title for the book. This overrides the value given in the opf file. --mobifile MOBIFILE Name of the output file. This overrides the default value. --htmlfile HTMLFILE Saves the html that is packed into mobi format. This html code contains Mobipocket specific things that are added automatically. This is mostly useful for debugging. --coverimage IMAGE The image to be used as cover in a library listing like the one in Cybook Gen3. The image will be rescaled to a suitable format (180x240). If no image is specified the first image in the source files is used. --gentoc For a collection of html files generate the table of contents automatically. --pda Scale images to work for pda's (must be used for Alice to work on my Palm T5). --scale f Scale all images that are smaller then a certain size with scale factor f. EXAMPLES html2mobi Alice_In_Wonderland.opf html2mobi Alice_In_Wonderland.html TODO - Specify margins with flags - Follow local links when given a root html file BUGS - Image sizes is not handled correctly for Palm T5. Large images works on Gen3 but are problematic on T5. - Guide specified toc not generated - Not correct author in EXTH - Plus a lot more.... this is an alpha version AUTHOR Tommy Persson (tpe@ida.liu.se) |
![]() |
![]() |
![]() |
#44 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 75,617
Karma: 134254544
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
What image sizes are you allowing up to? Are you resizing if you have a LRGE image?
|
![]() |
![]() |
![]() |
#45 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,452
Karma: 7185064
Join Date: Oct 2007
Location: Linköpng, Sweden
Device: Kindle Voyage, Nexus 5, Kindle PW
|
Quote:
The cover image should be 600x800. I resized it to 80% of that for now. I also have s scale argument so you can scale all your images if you want. I will add whatever feature is requested in connection with images. |
|
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
html2mobi - html formatting | brunovg | Kindle Formats | 2 | 12-13-2009 05:56 AM |
Old Version Mobigen needed | wilko10 | Kindle Formats | 11 | 11-25-2008 08:10 PM |
Does someone still have Mobigen 6.01 build 37? | IceHand | Kindle Formats | 7 | 03-03-2008 05:04 PM |
lit2mobi written in Perl working | tompe | Bookeen | 7 | 01-19-2008 01:06 PM |
MobiPocket TOC using mobigen | wallcraft | Reading and Management | 4 | 12-07-2007 09:45 AM |