Sort out start of bible translations (multi language) Chapter Names.

Chapter counts 
Verse Counts

bzr-revno: 66
This commit is contained in:
Tim Bentley 2008-11-01 19:50:14 +00:00
parent cfe7e7d00e
commit c3327988b9
4 changed files with 60 additions and 5 deletions

View File

@ -216,8 +216,6 @@ class BibleDBImpl:
print "getBibleChapter ", bookname, chapter print "getBibleChapter ", bookname, chapter
metadata.bind.echo = False metadata.bind.echo = False
s = text (""" select book.name FROM verse,book where verse.book_id == book.id AND verse.chapter == :c and book.name == :b """) s = text (""" select book.name FROM verse,book where verse.book_id == book.id AND verse.chapter == :c and book.name == :b """)
print s
print self.db.execute(s, c=chapter, b=bookname).fetchone()
return self.db.execute(s, c=chapter, b=bookname).fetchone() return self.db.execute(s, c=chapter, b=bookname).fetchone()
def getBibleText(self, bookname, chapter, sverse, everse): def getBibleText(self, bookname, chapter, sverse, everse):

View File

@ -36,9 +36,17 @@ class BibleManager:
""" """
self.bibleDBCache = {} self.bibleDBCache = {}
self.bibleHTTPCache = {} self.bibleHTTPCache = {}
self.booksOfBible = {}
self.listOfBooks = []
self.booksChapters = {}
self.CWids = {}
self.verses = {}
self.verseData = {}
self.biblePath = ConfigHelper.getBiblePath() self.biblePath = ConfigHelper.getBiblePath()
#print self.biblePath #print self.biblePath
files = os.listdir(self.biblePath) files = os.listdir(self.biblePath)
fbibles=open("../resources/bibles_en.txt", 'r')
fbibledata=open("../resources/bible_books.txt", 'r')
for f in files: for f in files:
b = f.split('.')[0] b = f.split('.')[0]
self.bibleDBCache[b] = BibleDBImpl(b) self.bibleDBCache[b] = BibleDBImpl(b)
@ -48,6 +56,20 @@ class BibleManager:
nhttp.setBibleSource(biblesource) nhttp.setBibleSource(biblesource)
self.bibleHTTPCache[b] = nhttp self.bibleHTTPCache[b] = nhttp
# #
for line in fbibles:
p = line.split(",")
self.booksOfBible[p[0]] = p[1].replace('\n', '')
self.listOfBooks.insert(int(p[1].replace('\n', '')), p[0])
for line in fbibledata:
p = line.split(",")
self.booksChapters[p[0]]=p[1]
self.CWids[p[0]]=p[2].replace('\n', '')
v = p[3].replace('\n', '')
self.verseData[p[0]] = v
#print "\n", self.booksOfBible
#print "\n", self.booksChapters
#print "\n", self.CWids
#print "\n", self.verseData
#print self.bibleDBCache #print self.bibleDBCache
#print self.bibleHTTPCache #print self.bibleHTTPCache
@ -92,14 +114,27 @@ class BibleManager:
""" """
Returns a list of the books of the bible Returns a list of the books of the bible
""" """
return ["Gen","Exd","Matt","Mark"] return self.listOfBooks
def getBookVerseCount(self, bible, book, chapter): def getBookChapterCount(self, book):
print "getBookChapterCount ", book
"""
Returns all the number of Chapters for a given
book
"""
i = self.booksOfBible[book]
return self.booksChapters[i]
def getBookVerseCount(self, book, chapter):
print "getBookVerseCount ", book, chapter
""" """
Returns all the number of verses for a given Returns all the number of verses for a given
book and chapter book and chapter
""" """
return 28 i = self.booksOfBible[book]
v = self.verseData[i].split(":")
print v
return v[chapter-1] # sup 1 for zero indexing
def getVerseText(self, bible, book, chapter, sverse, everse = 0 ): def getVerseText(self, bible, book, chapter, sverse, everse = 0 ):
""" """

View File

@ -0,0 +1,11 @@
1,50,ge,31:25:3:4
2,40,ex,5:6:7:8
3,27,le,9:10:11:13
4,36,nu,1:35:6
5,34,de,1:3:4
23,150,ps,1:4:5
47,28,mt,25:23:30
48,15,mr,21:23:23
49,24,lu,23:43:34
50,21,joh,23:65:76
73,22,re,20:23:24

View File

@ -0,0 +1,11 @@
Genesis,1
Exodus,2
Leviticus,3
Numbers,4
Deutoronomy,5
Psalms,23
Matthew,47
Mark,48
Luke,49
John,50
Revelation,73