songsoffellowship¶
-
class
openlp.plugins.songs.lib.importers.songsoffellowship.
SongsOfFellowshipImport
(manager, **kwargs)[source]¶ Bases:
openlp.plugins.songs.lib.importers.openoffice.OpenOfficeImport
Import songs provided on disks with the Songs of Fellowship music books VOLS1_2.RTF, sof3words.rtf and sof4words.rtf
Use OpenOffice.org Writer for processing the rtf file
The three books are not only inconsistent with each other, they are inconsistent in themselves too with their formatting. Not only this, but the 1+2 book does not space out verses correctly. This script attempts to sort it out, but doesn’t get it 100% right. But better than having to type them all out!
It attempts to detect italiced verses, and treats these as choruses in the verse ordering. Again not perfect, but a start.
Add the author. OpenLP stores them individually so split by ‘and’, ‘&’ and comma. However need to check for “Mr and Mrs Smith” and turn it to “Mr Smith” and “Mrs Smith”.
Parameters: text – Author text
-
add_song_number
(song_no)[source]¶ Add a song number, store as alternate title. Also use the song number to work out which songbook we’re in
Parameters: song_no – The Song number
-
add_title
(text)[source]¶ Add the title to the song. Strip some leading/trailing punctuation that we don’t want in a title
Parameters: text – Title text
-
add_verse_line
(text)[source]¶ Add a line to the current verse. If the formatting has changed and we’re beyond the second line of first verse, then this indicates a change of verse. Italics are a chorus
Parameters: text – The verse text
-
finish_verse
()[source]¶ Verse is finished, store it. Note in book 1+2, some songs are formatted incorrectly. Here we try and split songs with missing line breaks into the correct number of verses.
-
new_song
()[source]¶ A change of song. Store the old, create a new … but only if the last song was complete. If not, stick with it
-
process_paragraph
(paragraph)[source]¶ Process a paragraph. In the first book, a paragraph is a single line. In the latter ones they may contain multiple lines. Each paragraph contains textportions. Each textportion has it’s own styling, e.g. italics, bold etc. Also check for page breaks, which indicates a new song in books 1+2. In later books, there may not be line breaks, so check for 3 or more newlines
Parameters: paragraph – The paragraph text
-
process_paragraph_line
(text)[source]¶ Process a single line. Throw away that text which isn’t relevant, i.e. stuff that appears at the end of the song. Anything that is OK, append to the current verse
Parameters: text – The text
-
process_paragraph_text
(text)[source]¶ Split the paragraph text into multiple lines and process
Parameters: text – The text
-
process_text_portion
(text_portion)[source]¶ Process a text portion. Here we just get the text and detect if it’s bold or italics. If it’s bold then its a song number or song title. Song titles are in all capitals, so we must bring the capitalization into line
Parameters: text_portion – A Piece of text