Helper class to import bibles from a third party source into OpenLP
find_and_create_book(name, no_of_books, language_id, guess_id=None)¶
Find the OpenLP book id and then create the book in this bible db
- name – Name of the book. If None, then fall back to the guess_id Str
- no_of_books – The total number of books contained in this bible Int
- language_id – The OpenLP id of the language of this bible Int
- guess_id – The guessed id of the book, used if name is None Int
get_book_ref_id_by_name(book, maxbooks=66, language_id=None)¶
Find the book id from the name or abbreviation of the book. If it doesn’t currently exist, ask the user.
- book – The name or abbreviation of the book
- maxbooks – The number of books in the bible
- language_id – The language_id of the bible
The id of the bible, or None
If no language is given it calls a dialog window where the user could select the bible language. Return the language id of a bible.
Parameters: bible_name – The language the bible is.
Get the language_id for the language of the bible. Fallback to user input if we cannot do this pragmatically.
- file_language – Language of the bible. Possibly retrieved from the file being imported. Str
- bible_name – Name of the bible to display on the get_language dialog. Str
The id of a language Int or None
Check if the supplied file is compressed
Parameters: file – A path to the file to check
parse_xml(filename, use_objectify=False, elements=None, tags=None)¶
Parse and clean the supplied file by removing any elements or tags we don’t use. :param filename: The filename of the xml file to parse. Str :param use_objectify: Use the objectify parser rather than the etree parser. (Bool) :param elements: A tuple of element names (Str) to remove along with their content. :param tags: A tuple of element names (Str) to remove, preserving their content. :return: The root element of the xml document
This method basically just initialises the database. It is called from the Bible Manager when a Bible is imported. Descendant classes may want to override this method to supply their own custom initialisation as well.
Parameters: wizard – The actual Qt wizard form.
Stops the import of the Bible.
Validate the supplied file
- filename – The supplied file
- tag – The expected root tag type
True if valid. ValidationError is raised otherwise.