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 11-26-2007, 10:35 PM   #31
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
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.
igorsk is offline   Reply With Quote
Old 11-27-2007, 06:17 AM   #32
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 igorsk View Post
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.
But it seems to matter or something else is wrong. On Gen3 I get a corrupted title and this corruption changes depending on how long the MOBI header is. So I assume it tries to read unitialized memory. Or how do I specify that the metadata does not exists?

What is the difference between version 3 and 4 and why is it preferred to use version 3?
tompe is offline   Reply With Quote
Advert
Old 11-27-2007, 06:57 AM   #33
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
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
Here's the format of EXTH header which immediately follows the MOBI header (i.e. at 0x10+MOBI.dwSize in rec0). I beleive you also need to set flag 0x40 in dword at MOBI+0x70 if EXTH is present.
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
igorsk is offline   Reply With Quote
Old 11-27-2007, 07:17 AM   #34
mrkai
Bit Wrangler
mrkai has a complete set of Star Wars action figures.mrkai has a complete set of Star Wars action figures.mrkai has a complete set of Star Wars action figures.mrkai has a complete set of Star Wars action figures.mrkai has a complete set of Star Wars action figures.
 
Posts: 181
Karma: 415
Join Date: Oct 2007
Device: Sony PRS-505
been following along here...

Quote:
Originally Posted by igorsk View Post
I beleive you also need to set flag 0x40 in dword at MOBI+0x70 if EXTH is present.
...and in the Version 4 mobi files generated by the latest Creator, this seems to be set to 0x50.

-K
mrkai is offline   Reply With Quote
Old 11-27-2007, 07:34 AM   #35
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
Well, 0x50 does include 0x40
igorsk is offline   Reply With Quote
Advert
Old 11-27-2007, 07:49 AM   #36
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
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.
tompe is offline   Reply With Quote
Old 11-27-2007, 08:38 AM   #37
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
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).
igorsk is offline   Reply With Quote
Old 11-27-2007, 10:47 AM   #38
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 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 -
Ideas?
tompe is offline   Reply With Quote
Old 11-27-2007, 11:04 AM   #39
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
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.
igorsk is offline   Reply With Quote
Old 11-27-2007, 11:55 AM   #40
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 igorsk View Post
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.
But I cannot get it to work on the Gen3 at all without using this. I tested now to set the EXTH flag to 0 and to not have any data at all after the MOBI header. My Gen3 said "Multipart books not supported" or something similar. The only way I have got it to load is by having an EXTH.

Maybe I should test just adding an author in EXTH. That might work...
tompe is offline   Reply With Quote
Old 11-27-2007, 05:20 PM   #41
mrkai
Bit Wrangler
mrkai has a complete set of Star Wars action figures.mrkai has a complete set of Star Wars action figures.mrkai has a complete set of Star Wars action figures.mrkai has a complete set of Star Wars action figures.mrkai has a complete set of Star Wars action figures.
 
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
mrkai is offline   Reply With Quote
Old 11-27-2007, 05:22 PM   #42
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 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...
tompe is offline   Reply With Quote
Old 11-27-2007, 07:20 PM   #43
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
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)
tompe is offline   Reply With Quote
Old 11-28-2007, 05:08 PM   #44
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 73,983
Karma: 128903378
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?
JSWolf is offline   Reply With Quote
Old 11-28-2007, 05:12 PM   #45
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 JSWolf View Post
What image sizes are you allowing up to? Are you resizing if you have a LRGE image?
Well I will allow whtever the user want to specify and try to find out what the limts are on different devices. If the limits are different. Since the Mobigen format is not documented anywhere it is hard to know so the best you can do is test it for specific devices.

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.
tompe is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
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


All times are GMT -4. The time now is 07:34 PM.


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