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 12-20-2007, 03:53 PM   #1
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
Mobiperl - Perl tools for handling MobiPocket files

Mobiperl is a collection of tools I am writing in Perl for handling MobiPocket files. Since it works OK and I am interested in suggestions for more functionality I start a new thread for it.

The latest version is 0.0.43 and it can be found here: http://www.ida.liu.se/~tompe/mobiperl/downloads/ (updated July 2013)

*original text*

I have not yet tested mobiperl in Windows yet but if nobody else beat me to it I will try to test it during and write down how to use the programs under Windows. As I understand it ActivePerl is very common and it contains PPM that can be used to install packages.

Currently Mobiperl consists of:
  • MobiHeader.pm: A class file for generating MOBI headers.
  • html2mobi: Program to convert HTML files or OPF structures to MobiPocket.
  • mobi2html: Can be used to decode a MobiPocket file to an HTML file. Now mostly useful for debugging.
  • lit2mobi: Convert a lit file to a MobiPocker file.
  • mobi2mobi: Manipulate a Mobipocket file. Can for example be used to change the title.

I am also planning to write a mobi2opf program that explodes a MobiPocket file and tries to create an OPF structure.

Last edited by DaleDe; 07-10-2013 at 10:52 AM. Reason: fix the links and update the version number.
tompe is offline   Reply With Quote
Old 12-20-2007, 03:59 PM   #2
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
Mobiperl: mobi2mobi

Since a lot of people have mentioned that it would be useful to be able to manipulate meta data and to add cover image to a prc or mobi file I wrote mobi2mobi. Here is the description of the program:

A program to manipulate MobiPocket files. Author and title can be set and a cover image (thumb nail image for Gen3) can be added.

There are two kind of prc files used for electronic books. One is a PalmDOC file which does not have a MOBI header but can contain HTML code marked up with MobiPocket specific markup and it can be read by a MobiPocket reader. For this format you cannot store meta information in the header. The other format is MobiPocket and it has a MOBI header and some additional data where you can store meta information and an extended title.

This program can change the extended title for a MobiPocket file. It can also automatically convert a PalmDOC file to a MobiPocket file and set the title.

It can also add author information to a PalmDOC file by converting it to a MobiPocket file and set the author meta information.

You can also add a prefix to a title in a MobiPocket file. This does not work for PalmDOC files.

It is possible to add an image to the file. If there are no other images in the file then the added image will be used as cover image and thumb nail image for Gen3.

Just running the program on a mobifile without any flags will print some information about the file.

Since there is no specification available for the MOBI header this program might generate books that are not entirely correct. So keep the original file...
tompe is offline   Reply With Quote
Advert
Old 12-20-2007, 04:44 PM   #3
diabloNL
Gadget Force®
diabloNL plays well with othersdiabloNL plays well with othersdiabloNL plays well with othersdiabloNL plays well with othersdiabloNL plays well with othersdiabloNL plays well with othersdiabloNL plays well with othersdiabloNL plays well with othersdiabloNL plays well with othersdiabloNL plays well with othersdiabloNL plays well with others
 
diabloNL's Avatar
 
Posts: 705
Karma: 2733
Join Date: Jun 2006
Location: The Netherlands
Device: Sony PRS-300 + Cybook with funny screen :P
I would love to try it but I have no clue how to run it on Windows XP. I downloaded ActivePerl but don't know what to do next.
diabloNL is offline   Reply With Quote
Old 12-20-2007, 05:41 PM   #4
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 diabloNL View Post
I would love to try it but I have no clue how to run it on Windows XP. I downloaded ActivePerl but don't know what to do next.
I will test it myself in a couple of days and can give more information then.

For mobi2mobi you will need to install the Perl packages:
  • Palm::PDB
  • Palm:oc (how do you write Palm:: Doc without space?)
  • Date::Format
  • Getopt::Mixed
  • Image::Size

There should be something called PPM to install packages.

To check the documentation do "perldoc mobi2mobi". To change a title do 'perl mobi2mobi --title "New Title" --outfile newfile.mobi originalfile.mobi". I assume you have to use a dosbox or cygwin or some shell with ActivePerl to do this.

But I am really not a Windows user so I might be mistaken.
tompe is offline   Reply With Quote
Old 12-20-2007, 05:52 PM   #5
delphidb96
Wizard
delphidb96 ought to be getting tired of karma fortunes by now.delphidb96 ought to be getting tired of karma fortunes by now.delphidb96 ought to be getting tired of karma fortunes by now.delphidb96 ought to be getting tired of karma fortunes by now.delphidb96 ought to be getting tired of karma fortunes by now.delphidb96 ought to be getting tired of karma fortunes by now.delphidb96 ought to be getting tired of karma fortunes by now.delphidb96 ought to be getting tired of karma fortunes by now.delphidb96 ought to be getting tired of karma fortunes by now.delphidb96 ought to be getting tired of karma fortunes by now.delphidb96 ought to be getting tired of karma fortunes by now.
 
Posts: 2,999
Karma: 300001
Join Date: Jan 2007
Location: Citrus Heights, California
Device: TWO Kindle 2s, one each Bookeen Cybook Gen3, Sony PRS-500, Axim X51V
Hello!

Quote:
Originally Posted by tompe View Post
I will test it myself in a couple of days and can give more information then.

For mobi2mobi you will need to install the Perl packages:
  • Palm::PDB
  • Palm:oc (how do you write Palm:: Doc without space?)
  • Date::Format
  • Getopt::Mixed
  • Image::Size


There should be something called PPM to install packages.

To check the documentation do "perldoc mobi2mobi". To change a title do 'perl mobi2mobi --title "New Title" --outfile newfile.mobi originalfile.mobi". I assume you have to use a dosbox or cygwin or some shell with ActivePerl to do this.

But I am really not a Windows user so I might be mistaken.
Or... You could create a standalone Windows executable that does the same thing. This would be of great benefit to the millions of WinXP users who can't get PERL to work right and don't own Linux or OSX machines. After all, we're, by far, the greatest number of mobi readers.

PLEASE!!!

Derek
delphidb96 is offline   Reply With Quote
Advert
Old 12-20-2007, 06:51 PM   #6
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
If it is possible to create an executable than this might be an option. The disadvantage is that I have to boot to Windows to create a new version.

I have uploaded version 0.0.7. The bug I fixed was that the title change did not work for DRM:ed books. Now it works for my dictionary at least.
tompe is offline   Reply With Quote
Old 12-21-2007, 05:41 PM   #7
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
How to install ActivePerl on Windows for mobi2mobi and html2mobi

This is what you need to do to run the Mobiperl program on Windows.

Install ActivePerl 5.8.8 (easily found by google). maybe 5.10 also works but I did not test that version.

Start the "Perl Package Manager" (from the program menu) and install packages. A package can also be installed from a cmd prompt with "ppm install packagename".

For mobi2mobi install the packages:
  • p5-Palm
  • TimeDate
  • Getopt-Mixed
  • Image-Size

For html2mobi you have to add the repository http://theoryx5.uwinnipeg.ca/ppms/package.lst to the package manager (in preferences). Then install the packages:
  • XML-Parser-Lite-Tree
  • GD

Documentation for mobi2mobi and html2mobi can be found here:
tompe is offline   Reply With Quote
Old 12-21-2007, 05:47 PM   #8
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
For it to work on Windows with ActivePerl you need to get version 0.0.8 of Mobiperl.

I tested html2mobi on Windows with an HTML file and it worked. There was some problem with an opf file but I will look at that. I will also fix so that lit2mobi works properly on Windows.

It should be possible to package a Perl program in one Windows binary using PAR::Packer but I could not get it to work in Windows with ActivePerl (it did work in Linux). If I get this to work I will distribute the programs that way also. But the solution to the problem might be to wait for a better binary distribution of PAR::Packer and then it can take some time...
tompe is offline   Reply With Quote
Old 12-21-2007, 06:51 PM   #9
DaleDe
Grand Sorcerer
DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.
 
DaleDe's Avatar
 
Posts: 11,470
Karma: 13095790
Join Date: Aug 2007
Location: Grass Valley, CA
Device: EB 1150, EZ Reader, Literati, iPad 2 & Air 2, iPhone 7
Quote:
Originally Posted by tompe View Post
This is what you need to do to run the Mobiperl program on Windows.

Install ActivePerl 5.8.8 (easily found by google). maybe 5.10 also works but I did not test that version.

Start the "Perl Package Manager" (from the program menu) and install packages. A package can also be installed from a cmd prompt with "ppm install packagename".

For mobi2mobi install the packages:
  • p5-Palm
  • TimeDate
  • Getopt-Mixed
  • Image-Size

For html2mobi you have to add the repository http://theoryx5.uwinnipeg.ca/ppms/package.lst to the package manager (in preferences). Then install the packages:
  • XML-Parser-Lite-Tree
  • GD

Documentation for mobi2mobi and html2mobi can be found here:
When I added uwinnipeg to my preference it found 0 pkgs.

Dale
DaleDe is offline   Reply With Quote
Old 12-21-2007, 07:34 PM   #10
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 DaleDe View Post
When I added uwinnipeg to my preference it found 0 pkgs.
The same happened for me and it took some time to realize I had put the URL where the name should be and the name where the URL should be. Maybe you have done the same thing?
tompe is offline   Reply With Quote
Old 12-21-2007, 07:37 PM   #11
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
The uwinnipeg repository is need for the GD package. I also had to include the Palm:oc module in the mobiperl distribution since the package containing this module had an old version that did not work for MOBI files.
tompe is offline   Reply With Quote
Old 12-21-2007, 10:42 PM   #12
delphidb96
Wizard
delphidb96 ought to be getting tired of karma fortunes by now.delphidb96 ought to be getting tired of karma fortunes by now.delphidb96 ought to be getting tired of karma fortunes by now.delphidb96 ought to be getting tired of karma fortunes by now.delphidb96 ought to be getting tired of karma fortunes by now.delphidb96 ought to be getting tired of karma fortunes by now.delphidb96 ought to be getting tired of karma fortunes by now.delphidb96 ought to be getting tired of karma fortunes by now.delphidb96 ought to be getting tired of karma fortunes by now.delphidb96 ought to be getting tired of karma fortunes by now.delphidb96 ought to be getting tired of karma fortunes by now.
 
Posts: 2,999
Karma: 300001
Join Date: Jan 2007
Location: Citrus Heights, California
Device: TWO Kindle 2s, one each Bookeen Cybook Gen3, Sony PRS-500, Axim X51V
Quote:
Originally Posted by tompe View Post
The uwinnipeg repository is need for the GD package. I also had to include the Palm:oc module in the mobiperl distribution since the package containing this module had an old version that did not work for MOBI files.
I guess the one big problem I have with these tools is that I've got to put Yet Another Stupid Scripting Tool onto my system just to get it to run. And ActivePerl costs *money*! What?!? I've got to pay money to a *THIRD* party in order to run your apps? Hunh-unh! If I'm going to pay money, it should go to you. I done paid enough money when I paid HP and Microsoft for my computer system. Been There, Done That, Ain't Gonna Do It Again!

So, as nice as your mobitools appear to be, I won't be using them until they are turned into true executable apps.

Derek
delphidb96 is offline   Reply With Quote
Old 12-21-2007, 10:44 PM   #13
delphidb96
Wizard
delphidb96 ought to be getting tired of karma fortunes by now.delphidb96 ought to be getting tired of karma fortunes by now.delphidb96 ought to be getting tired of karma fortunes by now.delphidb96 ought to be getting tired of karma fortunes by now.delphidb96 ought to be getting tired of karma fortunes by now.delphidb96 ought to be getting tired of karma fortunes by now.delphidb96 ought to be getting tired of karma fortunes by now.delphidb96 ought to be getting tired of karma fortunes by now.delphidb96 ought to be getting tired of karma fortunes by now.delphidb96 ought to be getting tired of karma fortunes by now.delphidb96 ought to be getting tired of karma fortunes by now.
 
Posts: 2,999
Karma: 300001
Join Date: Jan 2007
Location: Citrus Heights, California
Device: TWO Kindle 2s, one each Bookeen Cybook Gen3, Sony PRS-500, Axim X51V
Quote:
Originally Posted by delphidb96 View Post
I guess the one big problem I have with these tools is that I've got to put Yet Another Stupid Scripting Tool onto my system just to get it to run. And ActivePerl costs *money*! What?!? I've got to pay money to a *THIRD* party in order to run your apps? Hunh-unh! If I'm going to pay money, it should go to you. I done paid enough money when I paid HP and Microsoft for my computer system. Been There, Done That, Ain't Gonna Do It Again!

So, as nice as your mobitools appear to be, I won't be using them until they are turned into true executable apps.

Derek
P.S.

If scripting tools are so wonderful, why do I need so many of them? Ruby, Python, Perl, Javascript, VBscript... Then there's the MS .Net - GAWD!

delphidb96 is offline   Reply With Quote
Old 12-22-2007, 06:24 AM   #14
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 delphidb96 View Post
I guess the one big problem I have with these tools is that I've got to put Yet Another Stupid Scripting Tool onto my system just to get it to run. And ActivePerl costs *money*! What?!? I've got to pay money to a *THIRD* party in order to run your apps? Hunh-unh! If I'm going to pay money, it should go to you. I done paid enough money when I paid HP and Microsoft for my computer system. Been There, Done That, Ain't Gonna Do It Again!

So, as nice as your mobitools appear to be, I won't be using them until they are turned into true executable apps.
ActivePerl does not cost money. There are versions that cost money but the basic version is free. Unfortunately the webb site is a bit confusing and I understand why you did not find the free version. Here is a link

http://www.activestate.com/store/pro...5-08d58c2648ca

to a page where you can choose ActivePerl which is free.

But I totally undestand that having executables is much better and will try to fix that. But if you want to be able to do extensions yourself or help to find bugs you need the development environment.

On the other hand you install or have a lot of programs on your computer that works on non executable code so it should not be an issue. Why do you have a program to read books? Why is not each book an executable?
tompe is offline   Reply With Quote
Old 12-22-2007, 08:03 AM   #15
diabloNL
Gadget Force®
diabloNL plays well with othersdiabloNL plays well with othersdiabloNL plays well with othersdiabloNL plays well with othersdiabloNL plays well with othersdiabloNL plays well with othersdiabloNL plays well with othersdiabloNL plays well with othersdiabloNL plays well with othersdiabloNL plays well with othersdiabloNL plays well with others
 
diabloNL's Avatar
 
Posts: 705
Karma: 2733
Join Date: Jun 2006
Location: The Netherlands
Device: Sony PRS-300 + Cybook with funny screen :P
I successfully changed the title of my book with mobi2mobi on my Windows XP. Thanks for the program Tommy! A small question though, when I imported it in MobiPocket Reader and then trying to send it to the Cybook, he asked me for the Login data of Fictionwise where I have bought the book. Could it be that mobi2mobi does something with the PID inside or sort?


EDIT: If the book already has a cover image, should it show the new cover image set by mobi2mobi? I tried it and it keeps showing the original.

Last edited by diabloNL; 12-22-2007 at 09:28 AM.
diabloNL 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 06:51 PM
Tools for Editing Kindle .mobi Files? GJN Kindle Formats 33 12-26-2013 03:05 PM
Handy Perl Script to convert HTML0 files to smartquotes maggotb0y Sony Reader 0 04-12-2007 12:49 PM
PRS-500 Perl tools to generate Reader content TadW Sony Reader Dev Corner 0 01-08-2007 06:55 AM
gmail copy (gmcp) - Perl script to copy files to/from Gmail Colin Dunstan Lounge 0 09-04-2004 02:24 PM


All times are GMT -4. The time now is 06:10 PM.


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