Most users only interact with Logos Bible Software as an ordinary desktop application. But underneath the hood is a powerful API called the Libronix Digital Library System Object Model (LDLSOM) that programmers can use to do all kinds of fancy tricks (you can download the documentation for free). Lately i’ve been working on automated processing of Bible dictionary content, and consequently i’ve been learning how to program against the LDLSOM. The climb is a little steep in the early part of the learning curve, but once you’ve ascended far enough there are some neat things you can do with it. And since everything is exposed as COM objects, any language with a COM interface (JavaScript, Perl, Python, even (gasp) Java) can be used with it.

Here’s a simple Python example, using an approach my colleague Rick Brannan developed, for extracting the ISBN numbers of resources in your Libronix library. Why? So you can upload them to LibraryThing. Here’s the deal: LibraryThing is a great social bookmarking service for bibliophiles, where you can find out who else has the same books you do and use that to discover common interests, popular titles, reviews, etc. A lifetime membership for LibraryThing is only $25, which seems like a bargain. But the other cost of admission is entering your library information. For dead tree books, you can use a CueCat scanner with the barcode to get a list of ISBN numbers (which you cue up so LibraryThing can look up and import the other metadata). But for electronic books like those in Libronix, how do you get the ISBNs? The best Libronix packages like Scholar’s Gold and Silver have thousands of resources, and looking each one up by hand is a daunting task.

LDLSOM to the rescue! The following snippet of Python code goes through each resource in your library, extracts the metadata (you can view this in the application with Help > About This Resource), and prints out the ISBN numbers for resources that have them (that’s a couple hundred for the version i have here at work). This assumes you have a standard Python installation (i use the excellent one from ActiveState) and one additional package for XML parsing: see the comments in the code. Unlike Rick’s version, there’s no user interface or other niceties: it just prints out the list. While i don’t want to provide basic Python tutorials (there are plenty of great ones out there already), if you know Python but can’t get this working, let me know (sean at logos here’s-the-dot com) and i’ll try to help. (i can’t get the indentation right, which Python cares about but WordPress loves to mangle: download the code here.)

If you use this to load your LibraryThing catalog, let me suggest you tag your books with “libronix“, which seems to be the most popular LIbraryThing tag at present for Libronix titles (though “ldls” and “Libronix ebook” are also in use).

import win32com.client
# requires XML processing library, available from
# or
from Ft.Xml import Parse
def toascii(str):
"""Silly hack for producing a mostly correct ASCII version of a
Unicode string."""
return str.encode('ascii', 'xmlcharrefreplace')
def main():
# get a handle for the application, starting it if necessary
ldls = win32com.client.Dispatch('LibronixDLS.LbxApplication')
# for each resource, get the DC metadata in XML, parse it, and extract
# the ISBN number (if any)
for res in ldls.Librarian.Information.Resources:
metadata = ldls.Librarian.OpenResourceMetadata(res.ResourceID)
dcm = metadata.XML.selectSingleNode("dc-metadata").xml
# presumably any unicode characters won't be in the ISBN
dcmobj = Parse(toascii(dcm))
isbnnode = dcmobj.xpath(u"/dc-metadata/dc-element[@name='dc.identifier:isbn']/text()")
if isbnnode:
print '%st"%s"' % (isbnnode[0].nodeValue, toascii(ldls.Librarian.GetResourceTitle(res.ResourceID)))
if __name__ == "__main__":