Mobileread
impfind
#21  tompe 10-18-2008, 06:49 PM
Quote nrapallo
I hear you loud and clear. Same with ME! When I updated PDFRead's python modules, I got brain freeze; still do. I think like perl is written, not like OOP! That's why my continued interest in writing some perl utilities.
I kind of like the Perl's object orientation. For larger Perl programs I always use it. And I used it a bit in MobiPerl.

My PerlTK programs usually starts out non-OO but when they grow they become a mess so I ususally add OO at some point.
Reply 

#22  derrell 10-18-2008, 08:22 PM
Quote nrapallo
Mobi2IMP.pl uses the .imp creation routine I "lifted" from the SBPubX.doc COM interface doucmentation that ships with eBook Publisher. It basically calls '$builder->Build($project);' to create the .imp. You use 'BuildFromProject', but how is it different than what I'm calling that doesn't make it work!
The main problem that I've had is getting the extra perl modules the scripts need installed in the activestate perl that I've got installed under wine. Even the exe version that uses par to budle all of the stuff up fails under wine with errors from par. I fought with it all for awhile then just said to heck with it. There is a point where its just not worth all the extra effort trying to get windows software to work under linux. Thats why I started thinking along the lines getting most of the work done in a native linux environment and using wine as little as possible. The little script that I wrote to run under wine uses only the AutoPublisher api. You pass in a path to the opf and it creates the imp file.


Quote nrapallo
So after installing eBook Publisher using wine, what do you call to create the .imp? Is it detailed in your EBookwise-1150-Linux@Wiki » wiki page?
I haven't added any of this to the wiki yet because it is such a mess to try getting wine set up to work with the command line tools. Impmake works but you have to have two seperate bottles for wine with eBook Publisher installed in them. The first can just be standard with only the core fonts installed into it. The second, where impmake will run, has to have some other dll's installed that allow the api calls from AutoPublisher to work but completely break the gui version of eBook Publisher.


Quote tompe
I kind of like the Perl's object orientation. For larger Perl programs I always use it. And I used it a bit in MobiPerl.

My PerlTK programs usually starts out non-OO but when they grow they become a mess so I ususally add OO at some point.
Yeah, at some point I'm going to have to break down and get comfortable with writing OO but since this is a hobby I just haven't taken the time to do it. My day job, or I should say night job since I work the graveyard shift, is being a machinist.
Reply 

#23  nrapallo 10-18-2008, 08:51 PM
Quote derrell
The main problem that I've had is getting the extra perl modules the scripts need installed in the activestate perl that I've got installed under wine. Even the exe version that uses par to budle all of the stuff up fails under wine with errors from par. I fought with it all for awhile then just said to heck with it. There is a point where its just not worth all the extra effort trying to get windows software to work under linux. Thats why I started thinking along the lines getting most of the work done in a native linux environment and using wine as little as possible.
Which .exe are you referring to? ebookpub or Mobi2IMP GUI? Just use the perl .pl scripts instead of the .exe, no?

Quote
The little script that I wrote to run under wine uses only the AutoPublisher api. You pass in a path to the opf and it creates the imp file.
So if you gave mobi2imp.pl (perl script) the mobi.prc, wouldn't it generate a .imp if you used BuildFromProject? If you send me/post the script, I can try to see if it is different from what I do. I haven't yet used/setup wine in ubuntu since I primarily use windows for ebook creation.

Quote
I haven't added any of this to the wiki yet because it is such a mess to try getting wine set up to work with the command line tools. Impmake works but you have to have two seperate bottles for wine with eBook Publisher installed in them. The first can just be standard with only the core fonts installed into it. The second, where impmake will run, has to have some other dll's installed that allow the api calls from AutoPublisher to work but completely break the gui version of eBook Publisher.
I understand from ashkulz that using impmake in linux requires you to jump through hoops, but if you don't with your script, then there could be a native way to generate a .imp from a .opf. I think we are on the right track here...

Quote
Yeah, at some point I'm going to have to break down and get comfortable with writing OO but since this is a hobby I just haven't taken the time to do it. My day job, or I should say night job since I work the graveyard shift, is being a machinist.
Same here; programming is a hobby, not full-time job, but a fun/rewarding hobby nevertheless!
Reply 

#24  derrell 10-18-2008, 11:08 PM
Sorry for being unclear.

Quote nrapallo
Which .exe are you referring to? ebookpub or Mobi2IMP GUI? Just use the perl .pl scripts instead of the .exe, no?
The Mobi2IMP.exe. Can't get this to run under wine. It throws errors with something to do with the par packaging. This is a wine issue because the executeable works fine under windows.

Quote nrapallo
So if you gave mobi2imp.pl (perl script) the mobi.prc, wouldn't it generate a .imp if you used BuildFromProject? If you send me/post the script, I can try to see if it is different from what I do. I haven't yet used/setup wine in ubuntu since I primarily use windows for ebook creation.
The problem with trying to run this script under wine is that all of the perl modules that it needs are not installed in the ActiveState version of perl that I have running under wine. So it isn't so much a problem with the script as it is with the installation of perl under wine. For these windows perl scripts to work you have to install a version of perl for windows in wine and then the other perl modules that the scripts need. I haven't been able to get any modules installed.

Quote nrapallo
I understand from ashkulz that using impmake in linux requires you to jump through hoops, but if you don't with your script, then there could be a native way to generate a .imp from a .opf. I think we are on the right track here...
I have to jump through the same hoops to make the perl script that I wrote work with AutoPublisher. But those same hoops don't let the more complicated mobi2imp.pl script work due to the perl modules that I haven't been able to get installed under wine. There is most likely a solution for that I just got tired of fighting the whole mess.

The hoop jumping is only in the initial setup though so once I get it working, just installing some dll's, I don't have to jump through anymore hoops to use the simpler script that only relies on what ActiveState installs to begin with.

Your automated conversion scripts work just fine in a virtual box install of XP. That requires me to be running virtual box and working in XP which is not a big deal but requires a lot file moving to get the books onto my reader which I do through linux using eb1150 and ebookutils. I have to start the virtual machine move the mobi book into that environment through a directory that is mounted as a network drive for XP. Then do the conversion and move it back into linux through the same directory and then into my bookshelf directory then I can put it on my reader. It is a hassle and being like I am I will spend a lot of hours trying to figure out how to make that easier. Probably enough hours that if I spent the same amount of time converting books through the longer method I could convert more than I could ever read.

The most common work flow for converting a lit book or a mobi book for me is this.

1. Explode the book with either Convert lit or mobi2oeb
2. Open the opf file eBook Publisher.
3. Since the opf won't open in eBook Publisher add all the information and the html files to a new project in eBook Publisher.
4. Preview the Grayscale version of the book and hope that there aren't any weird and esoteric css formating problems.
5. Save the project which overwrites the original opf file and build the imp file.
6. Archive the whole thing with the original mobi or lit along with the exploded files and imp into a zip or bzip2 file.
7. Transfer a copy of the imp file to my reader.
8. FINALLY start reading my book that I most likely paid good money for.

Sorry for the long post but once I got started I couldn't stop.

Oh and here is the perl script that I'm using under wine. Still experimental and does not provide the ebook with a unique id number.

Code
#!/perl/bin/perl -w
use strict;
use Win32::OLE;
Win32::OLE->Initialize(Win32::OLE::COINIT_APARTMENTTHREADED);
my $builder = Win32::OLE->new("SBPublisher.Builder") or die "Unable to get IBuilder interface\n";
my ($opf) = @ARGV;
$builder->{TargetDevice} = 2;
$builder->BuildFromProject($opf);
if (Win32::OLE->LastError() != 0) { print "ERROR: Build method failed.\n";
} else { print "Done!\n";
}
print "Path to file " . $builder->{OutputFilename} . "\n";
Win32::OLE->Uninitialize();
exit;
And the wine command line.
Code
wine perl c:\\bin\\opf2imp.pl Mass_Effect_Revelation.opf
Reply 

#25  nrapallo 10-19-2008, 07:26 AM
Quote derrell
Sorry for being unclear.

The Mobi2IMP.exe. Can't get this to run under wine. It throws errors with something to do with the par packaging. This is a wine issue because the executeable works fine under windows.
Ok understood now; the Mobi2IMP.exe is built using this command in my ActiveState Perl for Windows:
Code
pp -o ..\bin\Mobi2IMP.exe mobi2imp.pl
If there is an alternative that works in wine then I could try using that, but it begs the question, why? Everything except the GUI part is coded in perl using tompe's mobiperl mobi2html as a base. I used his setup to get ActiveState Perl working with Mobi2IMP (see his install instructions here for the various operating systems mobiperl runs on).

Can you get mobiperl working? If so, you should be able to get mobi2imp.pl working then. I'm speaking generally/theorectically here as I know you have issues getting it to work.

However, if ActiveState Perl is supplemented with the (mobiperl) modules available at CSPAN, then it would appear that mobi2imp.pl might work except for the OLE calls to AutoPublisher, which are handled by you below and use BuildFromProject instead of Build.

Quote
The problem with trying to run this script under wine is that all of the perl modules that it needs are not installed in the ActiveState version of perl that I have running under wine. So it isn't so much a problem with the script as it is with the installation of perl under wine. For these windows perl scripts to work you have to install a version of perl for windows in wine and then the other perl modules that the scripts need. I haven't been able to get any modules installed.


I have to jump through the same hoops to make the perl script that I wrote work with AutoPublisher. But those same hoops don't let the more complicated mobi2imp.pl script work due to the perl modules that I haven't been able to get installed under wine. There is most likely a solution for that I just got tired of fighting the whole mess.

The hoop jumping is only in the initial setup though so once I get it working, just installing some dll's, I don't have to jump through anymore hoops to use the simpler script that only relies on what ActiveState installs to begin with.
I may need your guidance setting this up in ubuntu. I couldn't find where to install wine from? Update Manager? Add Programs?

Quote
Your automated conversion scripts work just fine in a virtual box install of XP. That requires me to be running virtual box and working in XP which is not a big deal but requires a lot file moving to get the books onto my reader which I do through linux using eb1150 and ebookutils. I have to start the virtual machine move the mobi book into that environment through a directory that is mounted as a network drive for XP. Then do the conversion and move it back into linux through the same directory and then into my bookshelf directory then I can put it on my reader. It is a hassle and being like I am I will spend a lot of hours trying to figure out how to make that easier. Probably enough hours that if I spent the same amount of time converting books through the longer method I could convert more than I could ever read.

The most common work flow for converting a lit book or a mobi book for me is this.

1. Explode the book with either Convert lit or mobi2oeb
2. Open the opf file eBook Publisher.
3. Since the opf won't open in eBook Publisher add all the information and the html files to a new project in eBook Publisher.
4. Preview the Grayscale version of the book and hope that there aren't any weird and esoteric css formating problems.
5. Save the project which overwrites the original opf file and build the imp file.
6. Archive the whole thing with the original mobi or lit along with the exploded files and imp into a zip or bzip2 file.
7. Transfer a copy of the imp file to my reader.
8. FINALLY start reading my book that I most likely paid good money for.

Sorry for the long post but once I got started I couldn't stop.

Oh and here is the perl script that I'm using under wine. Still experimental and does not provide the ebook with a unique id number.
This is the .imp generating code used in lit2sb.pl:
Code
sub html2geb2150 {	$opf_file = shift;	$builder=Win32::OLE->new("SBPublisher.Builder") or die "Unable to get Softbook Personal Publisher\n";	if ($GEB1150) {$builder->{TargetDevice}="2";}	else {$builder->{TargetDevice}="1";}	$builder->BuildFromProject($opf_file);
}
Very similar to your script, so does lit2sb.pl work for you in linux i.e. lit2sb.pl ebook.lit yields a .imp? how about Lit2sb.exe (I know pushing it )?

Thanks for the heads up; I am now going to try all of this in ubuntu and use (well try to use ) wine with mobi2imp.pl!
Reply 

#26  derrell 10-19-2008, 09:19 AM
Quote
I may need your guidance setting this up in ubuntu. I couldn't find where to install wine from? Update Manager? Add Programs?
Umm, add programs I think. I use fluxbox as my window manager and not gnome most of the time so the menus look different. Whatever command starts synaptic, the package manager for ubuntu. Once that is running just search for wine its in it the repositories.

I haven't tried lit2sb. After trying to get the mobi2imp.pl to work I sort of gave up on using windows apps. I've been trying to use them as little as possible during the conversion. Things are simpler that way

Mobiperl works fine under just linux. It would run into the same problems though under wine. I can't install any perl modules from activestate into the windows perl installation. As I said there is most likely a way around that but I didn't ever find it.
Reply 

#27  nrapallo 10-22-2008, 08:53 AM
Quote derrell
And the wine command line.
Code
wine perl c:\\bin\\opf2imp.pl Mass_Effect_Revelation.opf
OK, I'm stuck here!

To use mobi2imp.pl, I started by first setting up eBook Publisher and the imp viewer as per your wiki writeup, and it's working just fine!

I downloaded and installed tompe's mobiperl and used cspan to get the required modules. I couldn't get GD to install, so I had to download and install libgd first (all done using sudo!).

Then I had to move the MobiPerl and Palm libs to /usr/local/lib/perl/5.8.8 for them to be recognized by my ubuntu 8.04 default perl setup! Mobiperl now also works!!!!

OK, how do I use just mobi2imp.pl? If I issue, perl mobi2imp.pl, I get that it couldn't find Win32/OLE.pm.

I think you said you have to install ActivePerl under wine to use your opf2imp.pl script above. Is that right, I have to download the windows version of ActivePerl and install under wine, even though I already have perl installed on this linux box?

I just want to get your script and my mobi2imp.pl working, but both are missing the OLE.pm. It's not possible to just copy OLE.PM to the linux installation, right?

I issued your wine command above, but it complained that perl.exe could not be found, hence the need for ActivePerl to be installed there using wine, right?

Sorry for all the basic questions, but I'm learning this as I go.
Reply 

#28  derrell 10-22-2008, 10:50 AM
Ok hold on if you are checking this thread for an answer. I'm working on it but involves a lot of typing its going to take a bit.
Reply 

#29  nrapallo 10-22-2008, 11:30 AM
Quote derrell
Ok hold on if you are checking this thread for an answer. I'm working on it but involves a lot of typing its going to take a bit.
OK, I know all of this is , so post here or to a new thread.

Oh, by the way, no hurray for the response; I'll wait until you've got the time to write it up (what other choice do I have )

Thanks, derrell!
Reply 

#30  derrell 10-22-2008, 11:44 AM
Started a new thread here.
Reply 

 « First  « Prev   (3/3)
Today's Posts | Search this Thread | Login | Register