Jump to content

Please read the Forum Rules before posting.

Photo

Perl scripts to convert e-Sword 9 bblx and cmtx modules to mysword


  • Please log in to reply
101 replies to this topic

#41 WhereAreTheCoolKids

WhereAreTheCoolKids

    New to Bible Support

  • Veterans
  • Pip
  • 2 posts
Offline

Posted 18 November 2012 - 11:46 AM

Hi Rob,

Thanks for this wonderflul tool. I tried converting a localized bible version created by our local community. I get RTF parsing errors. If you could look at this .bblx file http://www.mediafire...bau5xmckjv0c4b8

Here is the error:
Posted Image

#42 Atheist Rob

Atheist Rob

    e-Sword Addict

  • Members (T)
  • PipPipPipPip
  • 83 posts
  • LocationThe Netherlands
Offline

Posted 18 November 2012 - 02:02 PM

Hi Aivan,

I know what the error is but given the way that my script does the parsing, this is extremely hard to solve. Here is an example of what goes wrong:
sqlite> select * from Bible where Book=3 and Chapter=1 and Verse=1;
3|1|1| \i Kautusan Tungkol sa Paghahandog at Hain \i0 \par		Tinawag ni Yahweh si Moises at mula sa Toldang Tipanan ay sinabi sa kanya,

There's two ways to indicate the start and end of RTF tags, the first is by using a tag inside braces like:
{\tag this text is influenced by the tag.} This is more text.
The second is by using a start and end tag like this:
\tag this text is influenced by the tag.\tag0 This is more text.

Your module uses the second mode, in this case to make part of the text italic (I assume the italic text is a title since there is a paragraph break follwing it). Since your local community created this module, ask them if it is possible to re-create the e-Sword module using braces instead of start/stop tags. You could also try to convert it via the TheWord tools (see Peter Pellerin's howto).

Regards,
Rob

#43 WhereAreTheCoolKids

WhereAreTheCoolKids

    New to Bible Support

  • Veterans
  • Pip
  • 2 posts
Offline

Posted 22 November 2012 - 04:14 AM

Hi Rob,

Thanks for getting back to me. I am not a Perl guy but I do understand what you are trying to do here. I am a programmer myself, probably I could think of a workaround to clean this stuff. Thanks for the heads up.

Thanks,
Aivan

#44 Arnie51

Arnie51

    Liking e-Sword

  • Veterans
  • PipPip
  • 19 posts
Offline

Posted 06 December 2012 - 03:03 PM

Hey Rob,
I was really grateful a while back when you converted e-sword's HSB4 to MySword. I'm just no good with computer stuff - I can't get the Perl thing to work for me...
Would you be able to do a little more converting? HSB4 has been updated with corrections, and it would be great to have HSB3, as well - the Hebrew OT with Strong's.
The e-sword site for the update is: http://www.biblesupp...ransliteration/
I'm sure you're busy with important stuff of your own; if you could find time to do this, it would be totally amazing!
Thanks,
Arnie
begraced@gmail.com

#45 Atheist Rob

Atheist Rob

    e-Sword Addict

  • Members (T)
  • PipPipPipPip
  • 83 posts
  • LocationThe Netherlands
Offline

Posted 09 December 2012 - 12:15 PM

Hi Arnie,

I uploaded all versions at http://www.biblesupp...e-all-versions/

Regards,
Rob

#46 John H Standlee

John H Standlee

    New to Bible Support

  • Veterans
  • Pip
  • 2 posts
Offline

Posted 09 March 2013 - 08:50 PM

Thanks for your work Rob! 

 

I ran into a problem that I fixed... well, the best way I knew how.  I've never touched Perl, but I know SQL... anyway, I have some e-Sword bibles that had more than one record for a verse, so I modified the following section and added/modified the noted lines:

 

 

# [JHS] BEGIN: added another prepared statement for updating a verse when multiple verses exist (don't know why)
my $sthw2=$dbhw->prepare('
    UPDATE Bible SET Scripture = Scripture || "<br>" || ? WHERE Book=? AND Chapter=? AND Verse=?;
');
# [JHS] END.

foreach my $ref2 (@$rowref) {
    if ($bk != $ref2->[0]) {
        $bk=$ref2->[0];
        my $nm=exists($bibnum{$bk})?$bibnum{$bk}:"UNK";
        print STDERR "\n$nm";
        $cp=0;
    }
    if ($cp != $ref2->[1]) {
        $cp=$ref2->[1];
        print STDERR " $cp";
    }
    $sthw->execute($ref2->[0],$ref2->[1],$ref2->[2],&unrtf($bk,$cp,$ref2->[2],$ref2->[3]));
    # [JHS] BEGIN: added this if statement to catch bad inserts, hope the error is because of dupe verses
    if ($sthw->err){
        $sthw2->execute(&unrtf($bk,$cp,$ref2->[2],$ref2->[3]),$ref2->[0],$ref2->[1],$ref2->[2]);
    }
    die "Error inserting $ref2->[0]/$ref2->[1]/$ref2->[2]/$ref2->[3]\n" if ($sthw2->err);
    # [JHS] END.
}

 

Maybe you can make it more standardized, I assume that an error is because of the dupe verse deal, and it still displays the error on the initial insert, but it seems to be working.

 

~~ John


Edited by John H Standlee, 09 March 2013 - 08:52 PM.


#47 ForbesWilson

ForbesWilson

    New to Bible Support

  • Members
  • Pip
  • 3 posts
Offline

Posted 16 March 2013 - 06:44 AM

I am very interested in two of your posts, this one, and the ESV bible for Mysword. After a long battle, I managed to download Strawberry Perl Portable executable. I created a folder in the root directory c:\strawberry, copied the zip folder there and unpacked it. When I run portableshell.bat, the computer opens the dos box at c:\strawberry>. When I enter the command "c:\Strawberry> perl escmtx2mys.pl DailyStudyBible.cmtx" the response is "Can't open perl script "escmtx2mys.pl": No such file or directory

I am obviously doing something wrong. Can you help.

Regards, Forbes



#48 Atheist Rob

Atheist Rob

    e-Sword Addict

  • Members (T)
  • PipPipPipPip
  • 83 posts
  • LocationThe Netherlands
Offline

Posted 16 March 2013 - 07:56 AM

John, thanks for this. I'll include it in the script and re-upload the modified version.

 

Forbes, copy the escmtx2mys.pl script as well as the DailyStudyBible.cmtx file to the c:\strawberry directory. Same goes for the esvorg2mysword.pl script. If you have the scipt and comment file in another directory, you should change to that directory first. E.g., if they are in the c:\Temp directory, do a "cd c:\Temp" from within the portableshell dos box.
Hope that helps!

 

Regards,

Rob



#49 ForbesWilson

ForbesWilson

    New to Bible Support

  • Members
  • Pip
  • 3 posts
Offline

Posted 17 March 2013 - 12:09 AM

Hi Rob

Thanks for the reply. I copied the esvbblx2mys.pl file into the directory and ran the command. It started downloading the bible, and got as far as Exodus 5, and bombed out with the message "Exodus 1 2 3 4 5 Did not receive correct text for http://www.esvbible.org/Exodus+5/. Quitting"

Regards,

Forbes


Edited by ForbesWilson, 17 March 2013 - 12:29 AM.


#50 Atheist Rob

Atheist Rob

    e-Sword Addict

  • Members (T)
  • PipPipPipPip
  • 83 posts
  • LocationThe Netherlands
Offline

Posted 17 March 2013 - 02:28 AM

Just to be on the safe side, I tried the script myself and it created a good ESV module. The only thing I can think of is that you had a hickup in your Internet connection. This error is triggered if the script cannot find any verses in the downloaded chapter. Please try again.

 

Regards,

Rob






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users




Similar Topics



Latest Blogs