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
100 replies to this topic

#1 Atheist Rob

Atheist Rob

    e-Sword Addict

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

Posted 11 September 2011 - 05:02 AM

I have written two simple perl scripts to convert unencrypted e-Sword 9 bible and commentary modules to MySword. Besides perl, the script requires the DBI and DBD::SQLite perl modules. Unzip the perl scripts into the directory with the ".bblx" or ".cmtx" files that you wish to convert.

If you run any major Linux distribution, you already have perl on board. To test if you have the modules installed, issue the command "perl -e 'use DBI; use DBD::SQLite;'" (the single quotes are part of the command, the double quotes ae not). If you get an error, indicating that a module is missing from @INC, you need to install the modules. On Debian or a derivative distribution (like Ubuntu), use the command "apt-get install libdbd-sqlite3-perl". On Fedora and RedHat derivatives, the command is "yum install perl-DBD-SQLite" (on RHEL, CentOS or Scientific Linux you may want to include the "rpmforge" repository).

If you run Windows, this script can be used with Strawberry Perl. I advise you to download the portable executable, because that doesn't need installation. Just unpack the distribution somewhere, run the "portableshell.bat" batch file and you have a DOS box where you're good to go (see screen dump).

Change to the directory where you have the perl scripts and bible/commentary files and execute "perl esbblx2mys.pl <bible file>" or "perl escmtx2mys.pl <commentary file>" This will create a MySword file in the same directory. Repeat as needed.


strawberryh.png

Some things to consider:

  • The MySword names are based on the bible abbreviations. If you have a file named "king_james.bblx" that uses the abbreviation "KJV", the MySword file becomes "KJV.bbl.mybible".
  • In e-Sword, commentary files can cross chapters, in MySword they cannot. If you have a ".cmtx" file that has a companion ".bblx", have the ".bblx" present in the same directory as the commentary file with the same name except for the ".bblx" extension i.o. ".cmtx". This will be used to find the last verse number of the chapter. If the bible file is not present, the current verse is used, followed by the range in the next chapter.
  • If in a bible file, we encounter green superscript numbers, possibly preceded by a "G" or "H", it is considered to be a Strong's dictionary reference and it is encoded as such in the MySword bible file.
  • If in a bible file, we encounter red superscript text (like in the NET bible), we consider it a commentary reference and it will be encoded as such. This will reference a commentary module with the same abbreviation as the bible. If the reference text includes a chapter and verse, that is the place where the reference will point to in the commentary module. Else, it will point to the current verse.

Drop me a note if you have a question or if you notice some markup that I missed. In the latter case I might require you to send me your module file so I can see what the markup looks like in the original.

Regards,
Rob

P.S., as my handle implies, I am actually an atheist with an interest in the bible. Please refrain from proselytizing. Let's just agree to disagree on the question of the existence of gods.

Edited to add 2012-08-29: I modified the bible conversion script to better handle UTF characters and RTF tags. If you find a bug, please send me a PM. Thanks to user ebulerdo for thr references to the RTF tags that are being used. If I have some spare time I will also edit the comment conversion script.

Edited to add 2014-08-08: I modified the bible conversion script slightly to better handle nested RTF tags and to do more in memory so it runs faster.

 

Edited to add 2014-08-11: The commentary conversion script has been modified to fix the same issues as the bible conversion script. Created a single zip file with both scripts.

 

Attached Files


Edited by Atheist Rob, 11 August 2014 - 07:57 AM.


#2 pfpeller

pfpeller

    Moderator

  • Moderators
  • 1,112 posts
  • LocationWA
Offline

Posted 11 September 2011 - 10:27 AM

Thanks for sharing Athiest Rob.

Have you tried the MySword theWord to MySword migration tools for Bibles, Commentaries, Books, and Dictionaries?

Do these perl scripts offer advantages besides the the fact that they can run on a non Windows operating system?

Blessings,
Peter

#3 Atheist Rob

Atheist Rob

    e-Sword Addict

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

Posted 11 September 2011 - 10:39 AM

Hi Peter,

As far as I know, the conversion tools that go from e-Sword to The Word to MySword only work on e-Sword version 8 modules. These scripts are for e-Sword 9 modules to MySword (without the TheWord intermediary). I wrote them for my own use since I had a few Dutch e-Sword modules that I generated from the biblija.net website and I wanted them on MySword as well.

The drawback for my tools is that they only convert bible and commentary files, not dictionaries etc.

Regards,
Rob

#4 pfpeller

pfpeller

    Moderator

  • Moderators
  • 1,112 posts
  • LocationWA
Offline

Posted 11 September 2011 - 10:43 AM

You are right Rob. For Bible files, I usually have to convert them from e sword 9 to e sword 8 using BeST, so the task can be accomplished with the tools, but I am sure it takes longer than your tools.

You have to use BeST to go from 9x to 8x, the word importer, and then the MySword migration tools.

I migrate a lot of foreign language Bibles for individuals to MySword, so the method works, just a bit tedious.

I will try out your tools later today.

Thanks

#5 Josh Bond

Josh Bond

    Administrator

  • Administrators
  • PipPipPipPipPip
  • 2,880 posts
  • LocationGallatin, TN
Offline

Posted 11 September 2011 - 11:42 AM

Thanks for making these tools, Rob!

#6 Leonidas Shredder

Leonidas Shredder

    New to Bible Support

  • Veterans
  • Pip
  • 3 posts
  • LocationCleveland, OH
Offline

Posted 23 September 2011 - 04:21 PM

Hi Rob, thanks for posting these tools!
When I run my modules through the converter everything seems to be ok. The proper files are output. When I try to load them in MySword, they're just full of weird random characters. Am I doing something wrong?

#7 pfpeller

pfpeller

    Moderator

  • Moderators
  • 1,112 posts
  • LocationWA
Offline

Posted 23 September 2011 - 05:00 PM

Hello Leonidas,
Were the modules you were trying to convert encrypted?

#8 Leonidas Shredder

Leonidas Shredder

    New to Bible Support

  • Veterans
  • Pip
  • 3 posts
  • LocationCleveland, OH
Offline

Posted 24 September 2011 - 10:20 AM

Not sure -- how can I tell? Both modules (one bible and one commentary) were recently purchased from estudysource.com.

#9 pfpeller

pfpeller

    Moderator

  • Moderators
  • 1,112 posts
  • LocationWA
Offline

Posted 24 September 2011 - 10:22 AM

Official e sword modules cannot be converted to MySword because they are encrypted.

#10 Leonidas Shredder

Leonidas Shredder

    New to Bible Support

  • Veterans
  • Pip
  • 3 posts
  • LocationCleveland, OH
Offline

Posted 24 September 2011 - 10:31 AM

Right on! Thanks for the quick help. This site is great :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users




Similar Topics