diff --git a/openlp/plugins/songs/lib/importers/propresenter.py b/openlp/plugins/songs/lib/importers/propresenter.py index ca9a2e9c8..b0509393b 100644 --- a/openlp/plugins/songs/lib/importers/propresenter.py +++ b/openlp/plugins/songs/lib/importers/propresenter.py @@ -55,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') @@ -77,8 +77,5 @@ class ProPresenterImport(SongImport): rtf = base64.standard_b64decode(RTFData) words, encoding = strip_rtf(rtf.decode()) self.add_verse(words, "v%d" % count) - # Some songs don't have a title - use the first line as title - if not self.title: - self.title = self.guess_title() if not self.finish(): self.log_error(self.import_source) diff --git a/openlp/plugins/songs/lib/importers/songimport.py b/openlp/plugins/songs/lib/importers/songimport.py index 14622e978..5382efbe5 100644 --- a/openlp/plugins/songs/lib/importers/songimport.py +++ b/openlp/plugins/songs/lib/importers/songimport.py @@ -316,15 +316,6 @@ class SongImport(QtCore.QObject): self.verse_order_list_generated.append(self.verse_order_list_generated[-1]) self.verse_order_list_generated_useful = True - def guess_title(self): - """ - Guess the title from the first verse (to be used when the song has no title information) - :return: The guessed title - """ - if not self.verses: - return '' - return self.verses[0][1].split('\n')[0].strip() - def check_complete(self): """ Check the mandatory fields are entered (i.e. title and a verse) diff --git a/tests/functional/openlp_plugins/songs/test_propresenterimport.py b/tests/functional/openlp_plugins/songs/test_propresenterimport.py index 3b79961f9..f3bdcb959 100644 --- a/tests/functional/openlp_plugins/songs/test_propresenterimport.py +++ b/tests/functional/openlp_plugins/songs/test_propresenterimport.py @@ -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'))) diff --git a/tests/resources/propresentersongs/Vaste Grond.json b/tests/resources/propresentersongs/Vaste Grond.json new file mode 100644 index 000000000..f55abd83e --- /dev/null +++ b/tests/resources/propresentersongs/Vaste Grond.json @@ -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" + ] + ] +} \ No newline at end of file diff --git a/tests/resources/propresentersongs/Vaste Grond.pro4 b/tests/resources/propresentersongs/Vaste Grond.pro4 new file mode 100644 index 000000000..7abfb593d --- /dev/null +++ b/tests/resources/propresentersongs/Vaste Grond.pro4 @@ -0,0 +1 @@ +<_-RVRect3D-_position x="32.37209" y="29" z="0" width="1074.349" height="818.7442"><_-D-_serializedShadow containerClass="NSMutableDictionary"><_-RVRect3D-_position x="32.37209" y="29" z="0" width="1074.349" height="818.7442"><_-D-_serializedShadow containerClass="NSMutableDictionary"><_-RVRect3D-_position x="32.37209" y="29" z="0" width="1074.349" height="818.7442"><_-D-_serializedShadow containerClass="NSMutableDictionary"><_-RVRect3D-_position x="32.37209" y="29" z="0" width="1074.349" height="818.7442"><_-D-_serializedShadow containerClass="NSMutableDictionary"><_-RVRect3D-_position x="32.37209" y="29" z="0" width="1074.349" height="818.7442"><_-D-_serializedShadow containerClass="NSMutableDictionary"><_-RVRect3D-_position x="32.37209" y="29" z="0" width="1074.349" height="818.7442"><_-D-_serializedShadow containerClass="NSMutableDictionary"><_-RVRect3D-_position x="32.37209" y="29" z="0" width="1074.349" height="818.7442"><_-D-_serializedShadow containerClass="NSMutableDictionary"> \ No newline at end of file