forked from openlp/openlp
Head
This commit is contained in:
commit
c8a4522bee
@ -290,9 +290,9 @@ class SongFormat(object):
|
||||
},
|
||||
ProPresenter: {
|
||||
'class': ProPresenterImport,
|
||||
'name': 'ProPresenter',
|
||||
'name': 'ProPresenter 4',
|
||||
'prefix': 'proPresenter',
|
||||
'filter': '%s (*.pro4)' % translate('SongsPlugin.ImportWizardForm', 'ProPresenter Song Files')
|
||||
'filter': '%s (*.pro4)' % translate('SongsPlugin.ImportWizardForm', 'ProPresenter 4 Song Files')
|
||||
},
|
||||
SongBeamer: {
|
||||
'class': SongBeamerImport,
|
||||
|
@ -27,5 +27,5 @@
|
||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
###############################################################################
|
||||
"""
|
||||
The :mod:`~openlp.plugins.songs.lib.import` module contains importers for the Songs plugin.
|
||||
The :mod:`~openlp.plugins.songs.lib.importers` module contains importers for the Songs plugin.
|
||||
"""
|
||||
|
@ -33,17 +33,20 @@ ProPresenter song files into the current installation database.
|
||||
|
||||
import os
|
||||
import base64
|
||||
import logging
|
||||
from lxml import objectify
|
||||
|
||||
from openlp.core.ui.wizard import WizardStrings
|
||||
from openlp.plugins.songs.lib import strip_rtf
|
||||
from .songimport import SongImport
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class ProPresenterImport(SongImport):
|
||||
"""
|
||||
The :class:`ProPresenterImport` class provides OpenLP with the
|
||||
ability to import ProPresenter song files.
|
||||
ability to import ProPresenter 4 song files.
|
||||
"""
|
||||
def do_import(self):
|
||||
self.import_wizard.progress_bar.setMaximum(len(self.import_source))
|
||||
@ -52,11 +55,11 @@ class ProPresenterImport(SongImport):
|
||||
return
|
||||
self.import_wizard.increment_progress_bar(WizardStrings.ImportingType % os.path.basename(file_path))
|
||||
root = objectify.parse(open(file_path, 'rb')).getroot()
|
||||
self.process_song(root)
|
||||
self.process_song(root, file_path)
|
||||
|
||||
def process_song(self, root):
|
||||
def process_song(self, root, filename):
|
||||
self.set_defaults()
|
||||
self.title = root.get('CCLISongTitle')
|
||||
self.title = os.path.basename(filename).rstrip('.pro4')
|
||||
self.copyright = root.get('CCLICopyrightInfo')
|
||||
self.comments = root.get('notes')
|
||||
self.ccli_number = root.get('CCLILicenseNumber')
|
||||
@ -67,6 +70,9 @@ class ProPresenterImport(SongImport):
|
||||
count = 0
|
||||
for slide in root.slides.RVDisplaySlide:
|
||||
count += 1
|
||||
if not hasattr(slide.displayElements, 'RVTextElement'):
|
||||
log.debug('No text found, may be an image slide')
|
||||
continue
|
||||
RTFData = slide.displayElements.RVTextElement.get('RTFData')
|
||||
rtf = base64.standard_b64decode(RTFData)
|
||||
words, encoding = strip_rtf(rtf.decode())
|
||||
|
@ -52,3 +52,5 @@ class TestProPresenterFileImport(SongImportTestHelper):
|
||||
"""
|
||||
self.file_import([os.path.join(TEST_PATH, 'Amazing Grace.pro4')],
|
||||
self.load_external_result_data(os.path.join(TEST_PATH, 'Amazing Grace.json')))
|
||||
self.file_import([os.path.join(TEST_PATH, 'Vaste Grond.pro4')],
|
||||
self.load_external_result_data(os.path.join(TEST_PATH, 'Vaste Grond.json')))
|
||||
|
34
tests/resources/propresentersongs/Vaste Grond.json
Normal file
34
tests/resources/propresentersongs/Vaste Grond.json
Normal file
@ -0,0 +1,34 @@
|
||||
{
|
||||
"title": "Vaste Grond",
|
||||
"verse_order_list": [],
|
||||
"verses": [
|
||||
[
|
||||
"God voor U is niets onmogelijk\nHoe ongelofelijk\nU heeft alles in de hand",
|
||||
"v1"
|
||||
],
|
||||
[
|
||||
"U bent God en trekt Uw eigen plan\nU bent voor niemand bang\nVoor niets en niemand bang",
|
||||
"v2"
|
||||
],
|
||||
[
|
||||
"U houd me vast en geeft me moed\nOm door te gaan als ik niet durf\nIk wil van U zijn",
|
||||
"v3"
|
||||
],
|
||||
[
|
||||
"U geeft me kracht, en bent de vaste grond\nwaarop ik stevig sta\nik wil van U zijn, voor altijd van U zijn\nO God.",
|
||||
"v4"
|
||||
],
|
||||
[
|
||||
"Grote God, U bent uitzonderlijk\nen ondoorgrondelijk\nU biedt Uw liefde aan",
|
||||
"v5"
|
||||
],
|
||||
[
|
||||
"Wie ben ik, dat U mij ziet staan\nen met mij om wilt gaan?\nIk kan U niet weerstaan",
|
||||
"v6"
|
||||
],
|
||||
[
|
||||
"Onweerstaanbaar,\nonweerstaanbare God",
|
||||
"v7"
|
||||
]
|
||||
]
|
||||
}
|
1
tests/resources/propresentersongs/Vaste Grond.pro4
Normal file
1
tests/resources/propresentersongs/Vaste Grond.pro4
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user