Fix up OSIS to have book names and abbreviations

bzr-revno: 117
This commit is contained in:
Tim Bentley 2008-11-24 21:27:49 +00:00
parent 8dde1378e3
commit ae939c46be
2 changed files with 11 additions and 5 deletions

View File

@ -27,7 +27,6 @@ from openlp.plugins.biblemanager.BibleCSVImpl import BibleCSVImpl
from openlp.plugins.biblemanager.BibleDBImpl import BibleDBImpl from openlp.plugins.biblemanager.BibleDBImpl import BibleDBImpl
from openlp.plugins.biblemanager.BibleHTTPImpl import BibleHTTPImpl from openlp.plugins.biblemanager.BibleHTTPImpl import BibleHTTPImpl
from openlp.plugins.biblemanager.BibleLibrary import BibleLibrary from openlp.plugins.biblemanager.BibleLibrary import BibleLibrary
from openlp.plugins.plugin import Plugin
import logging import logging
logging.basicConfig(level=logging.DEBUG, logging.basicConfig(level=logging.DEBUG,
@ -36,7 +35,7 @@ logging.basicConfig(level=logging.DEBUG,
filename='plugins.log', filename='plugins.log',
filemode='w') filemode='w')
class BibleManager(Plugin): class BibleManager():
global log global log
log=logging.getLogger("BibleMgr") log=logging.getLogger("BibleMgr")
log.info("Bible manager loaded") log.info("Bible manager loaded")

View File

@ -36,6 +36,14 @@ class BibleOSISImpl():
log.info("BibleOSISImpl loaded") log.info("BibleOSISImpl loaded")
def __init__(self, bibledb): def __init__(self, bibledb):
self.bibledb = bibledb self.bibledb = bibledb
self.booksOfBible = {} # books of the bible linked to bibleid {osis , name}
self.abbrevOfBible = {} # books of the bible linked to bibleid {osis ,Abbrev }
fbibles=open("../resources/osisbooks_en.txt", 'r')
for line in fbibles:
p = line.split(",")
self.booksOfBible[p[0]] = p[1].replace('\n', '')
self.abbrevOfBible[p[0]] = p[2].replace('\n', '')
def loadData(self, osisfile): def loadData(self, osisfile):
self.bibledb.saveMeta("version", "Bible Version") self.bibledb.saveMeta("version", "Bible Version")
@ -80,9 +88,8 @@ class BibleOSISImpl():
p = ref.split(".", 3) # split u[ the reference p = ref.split(".", 3) # split u[ the reference
if book_ptr != p[0]: if book_ptr != p[0]:
book_ptr = p[0] book_ptr = p[0]
print p self.bibledb.createBook(int(p[1]), self.booksOfBible[p[0]] , self.abbrevOfBible[p[0]])
self.bibledb.createBook(int(p[1]), p[0], p[0]) id = self.bibledb.getBibleBookId(self.booksOfBible[p[0]])
id = self.bibledb.getBibleBookId(p[0])
self.bibledb.addVerse(id[0], p[1], p[2], t) self.bibledb.addVerse(id[0], p[1], p[2], t)