Add method to fully load bible

bzr-revno: 71
This commit is contained in:
Tim Bentley 2008-11-02 20:16:32 +00:00
parent 4d42c84ddb
commit c6d1051e82
2 changed files with 20 additions and 2 deletions

View File

@ -87,7 +87,7 @@ class BibleManager:
nhttp = BibleHTTPImpl() nhttp = BibleHTTPImpl()
nhttp.setBibleSource(biblesource) nhttp.setBibleSource(biblesource)
self.bibleHTTPCache[name] = nhttp self.bibleHTTPCache[name] = nhttp
nbible.loadMeta("WEB", biblesource) nbible.loadMeta("WEB", biblesource) # register a lazy loading interest
def registerBible(self, name, booksfile, versefile): def registerBible(self, name, booksfile, versefile):
""" """
@ -100,6 +100,24 @@ class BibleManager:
nbible.createTables() # Create Database nbible.createTables() # Create Database
nbible.loadData(booksfile, versefile) nbible.loadData(booksfile, versefile)
self.bibleDBCache[name] = nbible self.bibleDBCache[name] = nbible
def loadBible(self,bible):
print "loadBible ", bible
"""
Downloads all the books of the bible
and loads it into the database
"""
for bk in self.listOfBooks:
cptrs = self.booksChapters[ self.booksOfBible[bk]]
print bk , self.booksChapters[ self.booksOfBible[bk]]
for chptr in range(1 , int(cptrs)): # loop through all the chapters in book
c = self.bibleDBCache[bible].getBibleChapter(bk, chptr) # check to see if book/chapter exists
print c
if not c:
print "missing ", bk, chptr
self._loadBook(bible,bk)
self._loadChapter(bible, bk, chptr)
def getBibles(self): def getBibles(self):
""" """

View File

@ -2,7 +2,7 @@ Genesis,1
Exodus,2 Exodus,2
Leviticus,3 Leviticus,3
Numbers,4 Numbers,4
Deutoronomy,5 Deuteronomy,5
Psalms,23 Psalms,23
Matthew,47 Matthew,47
Mark,48 Mark,48