├── .gitignore ├── convert.py └── readme.md /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | niv'11.sqlite3 3 | niv 2011 -------------------------------------------------------------------------------- /convert.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | import sqlite3 5 | import re 6 | 7 | from unidecode import unidecode 8 | 9 | conn = sqlite3.connect("NIV'11.SQLite3") 10 | outputFileName = "NIV 2011" 11 | 12 | tags = ["", "", "", "", "", "", "", "", "", "", "", "", ""] 13 | 14 | c = conn.cursor() 15 | 16 | def tidyVerse(text): 17 | # Remove editorial notations 18 | text = re.sub("(.*?)", "", text) 19 | text = re.sub("\[(.*?)\]", "", text) 20 | 21 | for tag in tags: 22 | text = text.replace(tag, "") 23 | 24 | text = unidecode(text) 25 | 26 | return text 27 | 28 | allTheVerses = c.execute("SELECT books.long_name, verses.chapter, verses.verse, verses.text FROM books INNER JOIN verses ON verses.book_number = books.book_number") 29 | 30 | bookName = 0 31 | chapterNo = 0 32 | 33 | file = open(outputFileName, "w") 34 | 35 | file.write('\n') 36 | file.write('\n') 37 | 38 | # Loop through each verse in the bible… 39 | for row in allTheVerses: 40 | # If we're switching books… 41 | if bookName != row[0]: 42 | if (bookName != 0): 43 | file.write('\n\n') 44 | file.write('\n' % row[0]) 45 | file.write('\n' % row[1]) 46 | bookName = row[0] 47 | chapterNo = row[1] 48 | 49 | # If we're entering a new chapter… 50 | if chapterNo != row[1]: 51 | if (chapterNo != 0) or (chapterNo > row[1]): 52 | file.write('\n') 53 | 54 | file.write('\n' % (row[1])) 55 | chapterNo = row[1] 56 | 57 | # Spit out the verse… 58 | file.write('%s\n' % (row[2], tidyVerse(row[3]))) 59 | 60 | # Close everything off 61 | file.write('\n') 62 | file.write('\n') 63 | file.write('') 64 | 65 | file.close() -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # BibleConvertor 2 | 3 | This script will convert the `sqlite` files from [MyBible module repository](https://www.ph4.org/b4_index.php) to a file that [OpenLP](https://manual.openlp.org/bibles.html) and [OpenSong](http://www.opensong.org/home/importing) can read. 4 | 5 | Please note that this this has _only_ been tested with the [NIV 2011](https://www.ph4.org/b4_index.php?y=NIV) file importing into OpenSong and will require work for other files… 6 | 7 | ## Setup 8 | 9 | A small knowledge of Python is required to get this working… 10 | 11 | 12 | 1. Download and unzip the translation of the Bible you want from [MyBible module repository](https://www.ph4.org/b4_index.php) 13 | 2. [pip install Unidecode](https://pypi.org/project/Unidecode/) 14 | 3. Update python script (line 9 and 10) to point to the correct file 15 | 4. `python convert.py` 16 | 17 | ## Pull Requests? 18 | 19 | Yes. Please feel free. This was built quickly to scratch an itch I had. --------------------------------------------------------------------------------