From 60479d710fe76df0510c8c0dfc0f51e78dcda2b9 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Wed, 22 Oct 2008 18:47:19 +0000 Subject: [PATCH] bzr-revno: 25 --- openlp/database/BibleManager.py | 56 +++++++++++++++++++++++++++++++++ openlp/database/__init__.py | 0 2 files changed, 56 insertions(+) create mode 100644 openlp/database/BibleManager.py create mode 100644 openlp/database/__init__.py diff --git a/openlp/database/BibleManager.py b/openlp/database/BibleManager.py new file mode 100644 index 000000000..bfb1a99c9 --- /dev/null +++ b/openlp/database/BibleManager.py @@ -0,0 +1,56 @@ +import os, os.path +import sys +mypath=os.path.split(os.path.abspath(__file__))[0] +sys.path.insert(0,(os.path.join(mypath, '..', '..'))) + +from openlp.utils import ConfigHelper + +class BibleManager: + def __init__(self): # bible, type, path, user, password): # , type='sqlite' + """ + Finds all the bibles defined for the system + Creates an Interface Object for each bible containing connection information + Throws Exception if no Bibles are found. + + Init confirms the bible exists and stores the database path. + """ + #if bible != "niv" and bible !="message": + # raise Exception('Unsupported bible requested ' + bible) + self.biblePath = ConfigHelper.getBiblePath() + print self.biblePath + + + def getBibles(self): + """ + Returns a list of Books of the bible + """ + print "get Bibles" + return ["NIV","The_Message"] + + def getBibleBooks(self,bible): + """ + Returns a list of the books of the bible + """ + return ["Gen","Exd","Matt","Mark"] + + def getBookVerseCount(self, bible, book, chapter): + """ + Returns all the number of verses for a given + book and chapter + """ + return 28 + + def getVerseText(self, bible,book, chapter, sverse, everse): + """ + Returns a list of verses for a given Book, Chapter and ranges of verses. + If the end verse(everse) is less then the start verse(sverse) + then only one verse is returned + """ + + if everse < sverse: + print "adjusted end verse" + everse = sverse + return ["In the Beginning was the Word","God made the world as saw it was good"] + + +bm = BibleManager() diff --git a/openlp/database/__init__.py b/openlp/database/__init__.py new file mode 100644 index 000000000..e69de29bb