diff --git a/openlp/database/BibleImpl.py b/openlp/database/BibleImpl.py index a6ca28c3e..2a57babc8 100644 --- a/openlp/database/BibleImpl.py +++ b/openlp/database/BibleImpl.py @@ -46,12 +46,12 @@ verses = Table('Verses', metadata, ) Index('idx_chapter_verse_book', verses.c.chapter, verses.c.verse, verses.c.book_id, verses.c.id) -class bible_impl: - def __init__(self, filename): +class BibleImpl: + def __init__(self, biblename): # Connect to database path = ConfigHelper.getBiblePath() print path - biblefile = os.path.join(path, filename+".bible") + biblefile = os.path.join(path, biblename+".bible") print biblefile self.db = create_engine("sqlite:///"+biblefile) self.db.echo = False diff --git a/openlp/database/BibleManager.py b/openlp/database/BibleManager.py index d23d4318c..16a13cab8 100644 --- a/openlp/database/BibleManager.py +++ b/openlp/database/BibleManager.py @@ -4,6 +4,7 @@ mypath=os.path.split(os.path.abspath(__file__))[0] sys.path.insert(0,(os.path.join(mypath, '..', '..'))) from openlp.utils import ConfigHelper +from openlp.database.BibleImpl import * class BibleManager: def __init__(self): @@ -16,17 +17,26 @@ class BibleManager: """ #if bible != "niv" and bible !="message": # raise Exception('Unsupported bible requested ' + bible) + self.biblelist = {} self.biblePath = ConfigHelper.getBiblePath() print self.biblePath + files = os.listdir(self.biblePath) + for f in files: + b = f.split('.')[0] + self.biblelist[b] = BibleImpl(b) + print self.biblelist + def getBibles(self): """ Returns a list of Books of the bible """ - print "get Bibles" - return ["NIV","The_Message"] - + r=[] + for b , o in self.biblelist.iteritems(): + r.append(b) + return r + def getBibleBooks(self,bible): """ Returns a list of the books of the bible diff --git a/openlp/database/test/testBibleLoader.py b/openlp/database/test/testBibleLoader.py index 8c59f7e6a..212b78e77 100644 --- a/openlp/database/test/testBibleLoader.py +++ b/openlp/database/test/testBibleLoader.py @@ -6,12 +6,12 @@ sys.path.insert(0,(os.path.join(mypath, '..', '..','..'))) from openlp.database.BibleImpl import * if __name__ == "__main__": - bi = bible_impl("TheMessage") + bi = BibleImpl("TheMessage") bi.create_tables() bi.Load_Data('biblebooks_msg_short.csv','bibleverses_msg_short.csv') bi.Run_Tests() - b2 = bible_impl("NIV") + b2 = BibleImpl("NIV") b2.create_tables() b2.Load_Data('biblebooks_msg_short.csv','bibleverses_msg_short.csv') b2.Run_Tests()