forked from openlp/openlp
Update Bibles and add NIV
Fix load to delete bibles if already loaded and 2nd load requested bzr-revno: 32
This commit is contained in:
parent
3b493aab23
commit
fc913785b9
@ -50,21 +50,23 @@ class BibleImpl:
|
||||
def __init__(self, biblename):
|
||||
# Connect to database
|
||||
path = ConfigHelper.getBiblePath()
|
||||
print path
|
||||
biblefile = os.path.join(path, biblename+".bible")
|
||||
print biblefile
|
||||
self.db = create_engine("sqlite:///"+biblefile)
|
||||
#print path
|
||||
self.biblefile = os.path.join(path, biblename+".bible")
|
||||
#print self.biblefile
|
||||
self.db = create_engine("sqlite:///"+self.biblefile)
|
||||
self.db.echo = False
|
||||
metadata.bind = self.db
|
||||
metadata.bind.echo = False
|
||||
|
||||
def create_tables(self):
|
||||
def createTables(self):
|
||||
if os.path.exists(self.biblefile): # delete bible file and set it up again
|
||||
os.remove(self.biblefile)
|
||||
meta.create()
|
||||
testament.create()
|
||||
books.create()
|
||||
verses.create()
|
||||
|
||||
def Load_Data(self, booksfile, versesfile):
|
||||
def loadData(self, booksfile, versesfile):
|
||||
|
||||
metai =meta.insert()
|
||||
metai.execute(key="dbversion", value="1")
|
||||
|
@ -17,14 +17,15 @@ class BibleManager:
|
||||
"""
|
||||
#if bible != "niv" and bible !="message":
|
||||
# raise Exception('Unsupported bible requested ' + bible)
|
||||
|
||||
self.biblelist = {}
|
||||
self.biblePath = ConfigHelper.getBiblePath()
|
||||
print self.biblePath
|
||||
#print self.biblePath
|
||||
files = os.listdir(self.biblePath)
|
||||
for f in files:
|
||||
b = f.split('.')[0]
|
||||
self.biblelist[b] = BibleImpl(b)
|
||||
print self.biblelist
|
||||
#print self.biblelist
|
||||
|
||||
|
||||
|
||||
@ -61,6 +62,3 @@ class BibleManager:
|
||||
print "adjusted end verse"
|
||||
everse = sverse
|
||||
return ["In the Beginning was the Word","God made the world as saw it was good"]
|
||||
|
||||
|
||||
bm = BibleManager()
|
||||
|
@ -2,7 +2,6 @@
|
||||
2,1,"Exodus","EXOD"
|
||||
3,1,"Leviticus","LEV"
|
||||
4,1,"Numbers","NUM"
|
||||
5,1,"Deuteronomy","DEUT"
|
||||
47,2,"Matthew","MATT"
|
||||
48,2,"Mark","MARK"
|
||||
49,2,"Luke","LUKE"
|
||||
|
|
9
openlp/database/test/biblebooks_niv_short.csv
Normal file
9
openlp/database/test/biblebooks_niv_short.csv
Normal file
@ -0,0 +1,9 @@
|
||||
1,1,"Genesis","GEN"
|
||||
2,1,"Exodus","EXOD"
|
||||
3,1,"Leviticus","LEV"
|
||||
4,1,"Numbers","NUM"
|
||||
46,1,"Malachi","MAL"
|
||||
47,2,"Matthew","MATT"
|
||||
48,2,"Mark","MARK"
|
||||
49,2,"Luke","LUKE"
|
||||
50,2,"John","JOHN"
|
|
@ -9,9 +9,6 @@
|
||||
"Leviticus",1,3,"""If the offering is a Whole-Burnt-Offering from the herd, present a male without a defect at the entrance to the Tent of Meeting that it may be accepted by God."
|
||||
"Numbers",1,1,"God spoke to Moses in the Wilderness of Sinai at the Tent of Meeting on the first day of the second month in the second year after they had left Egypt. He said,"
|
||||
"Numbers",1,2,"""Number the congregation of the People of Israel by clans and families, writing down the names of every male."
|
||||
"Numbers",3,1,"This is the family tree of Aaron and Moses at the time God spoke with Moses on Mount Sinai."
|
||||
"Numbers",3,2,"The names of the sons of Aaron: Nadab the firstborn, Abihu, Eleazar, and Ithamar -"
|
||||
"Numbers",3,3,"anointed priests ordained to serve as priests."
|
||||
"Matthew",1,1,"The family tree of Jesus Christ, David's son, Abraham's son:"
|
||||
"Matthew",1,2,"Abraham had Isaac, Isaac had Jacob, Jacob had Judah and his brothers,"
|
||||
"Matthew",1,3,"Judah had Perez and Zerah (the mother was Tamar), Perez had Hezron, Hezron had Aram,"
|
||||
@ -27,8 +24,6 @@
|
||||
"Mark",1,1,"The good news of Jesus Christ - the Message! - begins here,"
|
||||
"Mark",1,2,"following to the letter the scroll of the prophet Isaiah. Watch closely: I'm sending my preacher ahead of you; He'll make the road smooth for you."
|
||||
"Mark",1,3,"Thunder in the desert! Prepare for God's arrival! Make the road smooth and straight!"
|
||||
"Mark",5,1,"They arrived on the other side of the sea in the country of the Gerasenes."
|
||||
"Mark",5,2,"As Jesus got out of the boat, a madman from the cemetery came up to him."
|
||||
"Luke",1,1,"So many others have tried their hand at putting together a story of the wonderful harvest of Scripture and history that took place among us,"
|
||||
"Luke",1,2,"using reports handed down by the original eyewitnesses who served this Word with their very lives."
|
||||
"Luke",1,3,"Since I have investigated all the reports in close detail, starting from the story's beginning, I decided to write it all out for you, most honorable Theophilus,"
|
||||
|
Can't render this file because it contains an unexpected character in line 21 and column 146.
|
35
openlp/database/test/bibleverses_niv_short.csv
Normal file
35
openlp/database/test/bibleverses_niv_short.csv
Normal file
@ -0,0 +1,35 @@
|
||||
"Genesis",1,1,"In the beginning God created the heavens and the earth."
|
||||
"Genesis",1,2,"Now the earth was formless and empty, darkness was over the surface of the deep, and the Spirit of God was hovering over the waters."
|
||||
"Exodus",1,1,"These are the names of the sons of Israel who went to Egypt with Jacob, each with his family:"
|
||||
"Exodus",1,2,"Reuben, Simeon, Levi and Judah;"
|
||||
"Exodus",2,1,"Now a man of the house of Levi married a Levite woman,"
|
||||
"Exodus",2,2,"and she became pregnant and gave birth to a son. When she saw that he was a fine child, she hid him for three months."
|
||||
"Leviticus",1,1,"The Lord called to Moses and spoke to him from the Tent of Meeting. He said,"
|
||||
"Leviticus",1,2,"""Speak to the Israelites and say to them: 'When any of you brings an offering to the Lord, bring as your offering an animal from either the herd or the flock."
|
||||
"Leviticus",1,3,"""'If the offering is a burnt offering from the herd, he is to offer a male without defect. He must present it at the entrance to the Tent of Meeting so that it will be acceptable to the Lord."
|
||||
"Numbers",1,1,"The Lord spoke to Moses in the Tent of Meeting in the Desert of Sinai on the first day of the second month of the second year after the Israelites came out of Egypt. He said:"
|
||||
"Numbers",1,2,"""Take a census of the whole Israelite community by their clans and families, listing every man by name, one by one."
|
||||
"Matthew",1,1,"A record of the genealogy of Jesus Christ the son of David, the son of Abraham:"
|
||||
"Matthew",1,2,"Abraham was the father of Isaac,"
|
||||
"Matthew",1,3,"Judah the father of Perez and Zerah, whose mother was Tamar,"
|
||||
"Matthew",1,4,"Ram the father of Amminadab,"
|
||||
"Matthew",1,5,"Salmon the father of Boaz, whose mother was Rahab,"
|
||||
"Matthew",1,6,"and Jesse the father of King David."
|
||||
"Matthew",1,7,"Solomon the father of Rehoboam,"
|
||||
"Matthew",1,8,"Asa the father of Jehoshaphat,"
|
||||
"Matthew",2,1,"After Jesus was born in Bethlehem in Judea, during the time of King Herod, Magi from the east came to Jerusalem"
|
||||
"Matthew",2,2,"and asked, ""Where is the one who has been born king of the Jews? We saw his star in the east and have come to worship "Matthew",3,1,"In those days John the Baptist came, preaching in the Desert of Judea"
|
||||
"Matthew",3,2,"and saying, ""Repent, for the kingdom of heaven is near."""
|
||||
"Matthew",3,3,"This is he who was spoken of through the prophet Isaiah: ""A voice of one calling in the desert, 'Prepare the way for the Lord, make straight paths for him.'"""
|
||||
"Mark",1,1,"The beginning of the gospel about Jesus Christ, the Son of God."
|
||||
"Mark",1,2,"It is written in Isaiah the prophet: ""I will send my messenger ahead of you, who will prepare your way""--"
|
||||
"Mark",1,3,"""a voice of one calling in the desert, 'Prepare the way for the Lord, make straight paths for him.'"""
|
||||
"Luke",1,1,"Many have undertaken to draw up an account of the things that have been fulfilled among us,"
|
||||
"Luke",1,2,"just as they were handed down to us by those who from the first were eyewitnesses and servants of the word."
|
||||
"Luke",1,3,"Therefore, since I myself have carefully investigated everything from the beginning, it seemed good also to me to write an orderly account for you, most excellent Theophilus,"
|
||||
"John",1,1,"In the beginning was the Word, and the Word was with God, and the Word was God."
|
||||
"John",1,2,"He was with God in the beginning."
|
||||
"John",1,3,"Through him all things were made; without him nothing was made that has been made."
|
||||
"John",2,1,"On the third day a wedding took place at Cana in Galilee. Jesus' mother was there,"
|
||||
"John",2,2,"and Jesus and his disciples had also been invited to the wedding."
|
||||
"John",2,3,"When the wine was gone, Jesus' mother said to him, ""They have no more wine."""
|
Can't render this file because it contains an unexpected character in line 21 and column 135.
|
@ -7,11 +7,11 @@ from openlp.database.BibleImpl import *
|
||||
|
||||
if __name__ == "__main__":
|
||||
bi = BibleImpl("TheMessage")
|
||||
bi.create_tables()
|
||||
bi.Load_Data('biblebooks_msg_short.csv','bibleverses_msg_short.csv')
|
||||
bi.createTables()
|
||||
bi.loadData('biblebooks_msg_short.csv','bibleverses_msg_short.csv')
|
||||
bi.Run_Tests()
|
||||
|
||||
b2 = BibleImpl("NIV")
|
||||
b2.create_tables()
|
||||
b2.Load_Data('biblebooks_msg_short.csv','bibleverses_msg_short.csv')
|
||||
b2.createTables()
|
||||
b2.loadData('biblebooks_niv_short.csv','bibleverses_niv_short.csv')
|
||||
b2.Run_Tests()
|
||||
|
@ -6,6 +6,7 @@ sys.path.insert(0,(os.path.join(mypath, '..', '..','..')))
|
||||
from openlp.database.BibleManager import *
|
||||
|
||||
bm = BibleManager()
|
||||
print bm
|
||||
print bm.getBibles()
|
||||
b = bm.getBibles()
|
||||
for b1 in b:
|
||||
|
Loading…
Reference in New Issue
Block a user