Register Guidelines E-Books Search Today's Posts Mark Forums Read

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

Notices

Reply
 
Thread Tools Search this Thread
Old 12-20-2007, 02: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: 6,889
Karma: 2871945
Join Date: Oct 2007
Location: Linköpng, Sweden
Device: Nexus 7, Nexus 4, iPad 2, Notion Ink Adam Qi, Kindle WiFi, 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 09:52 AM. Reason: fix the links and update the version number.
tompe is online now   Reply With Quote
Old 12-20-2007, 02: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: 6,889
Karma: 2871945
Join Date: Oct 2007
Location: Linköpng, Sweden
Device: Nexus 7, Nexus 4, iPad 2, Notion Ink Adam Qi, Kindle WiFi, 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 online now   Reply With Quote
Old 12-20-2007, 03: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, 04: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: 6,889
Karma: 2871945
Join Date: Oct 2007
Location: Linköpng, Sweden
Device: Nexus 7, Nexus 4, iPad 2, Notion Ink Adam Qi, Kindle WiFi, 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 online now   Reply With Quote
Old 12-20-2007, 04: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: 3,000
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
Old 12-20-2007, 05: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: 6,889
Karma: 2871945
Join Date: Oct 2007
Location: Linköpng, Sweden
Device: Nexus 7, Nexus 4, iPad 2, Notion Ink Adam Qi, Kindle WiFi, 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 online now   Reply With Quote
Old 12-21-2007, 04: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: 6,889
Karma: 2871945
Join Date: Oct 2007
Location: Linköpng, Sweden
Device: Nexus 7, Nexus 4, iPad 2, Notion Ink Adam Qi, Kindle WiFi, 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 online now   Reply With Quote
Old 12-21-2007, 04: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: 6,889
Karma: 2871945
Join Date: Oct 2007
Location: Linköpng, Sweden
Device: Nexus 7, Nexus 4, iPad 2, Notion Ink Adam Qi, Kindle WiFi, 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 online now   Reply With Quote
Old 12-21-2007, 05: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: 9,400
Karma: 4544000
Join Date: Aug 2007
Location: Grass Valley, CA
Device: EB 1150, EZ Reader, Literati, iPad 2
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, 06: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: 6,889
Karma: 2871945
Join Date: Oct 2007
Location: Linköpng, Sweden
Device: Nexus 7, Nexus 4, iPad 2, Notion Ink Adam Qi, Kindle WiFi, 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 online now   Reply With Quote
Old 12-21-2007, 06: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: 6,889
Karma: 2871945
Join Date: Oct 2007
Location: Linköpng, Sweden
Device: Nexus 7, Nexus 4, iPad 2, Notion Ink Adam Qi, Kindle WiFi, 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 online now   Reply With Quote
Old 12-21-2007, 09: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: 3,000
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, 09: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: 3,000
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, 05: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: 6,889
Karma: 2871945
Join Date: Oct 2007
Location: Linköpng, Sweden
Device: Nexus 7, Nexus 4, iPad 2, Notion Ink Adam Qi, Kindle WiFi, 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 online now   Reply With Quote
Old 12-22-2007, 07: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 08:28 AM.
diabloNL is offline   Reply With Quote
Reply

Tags
mobi2mobi

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mobi2Mobi Mobi2Mobi v0.13 - GUI for Mobiperl tools Jad Kindle Formats 461 03-26-2014 12:59 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 04:42 AM.


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