diff --git a/openlp/plugins/songs/lib/songshowplusimport.py b/openlp/plugins/songs/lib/songshowplusimport.py index 0a8dc4650..c1c6d04cb 100644 --- a/openlp/plugins/songs/lib/songshowplusimport.py +++ b/openlp/plugins/songs/lib/songshowplusimport.py @@ -121,7 +121,7 @@ class SongShowPlusImport(SongImport): null, verse_no, = struct.unpack("BB", song_data.read(2)) elif block_key == CUSTOM_VERSE: null, verse_name_length, = struct.unpack("BB", song_data.read(2)) - verse_name = song_data.read(verse_name_length) + verse_name = self.decode(song_data.read(verse_name_length)) length_descriptor_size, = struct.unpack("B", song_data.read(1)) log.debug(length_descriptor_size) # Detect if/how long the length descriptor is @@ -147,7 +147,10 @@ class SongShowPlusImport(SongImport): elif block_key == COPYRIGHT: self.add_copyright(self.decode(data)) elif block_key == CCLI_NO: - self.ccli_number = int(data) + try: + self.ccli_number = int(data) + except ValueError: + continue elif block_key == VERSE: self.add_verse(self.decode(data), "%s%s" % (VerseType.tags[VerseType.Verse], verse_no)) elif block_key == CHORUS: diff --git a/tests/functional/openlp_plugins/songs/test_songshowplusimport.py b/tests/functional/openlp_plugins/songs/test_songshowplusimport.py index 7292bb2b0..08400fdc5 100644 --- a/tests/functional/openlp_plugins/songs/test_songshowplusimport.py +++ b/tests/functional/openlp_plugins/songs/test_songshowplusimport.py @@ -57,6 +57,8 @@ class TestSongShowPlusFileImport(SongImportTestHelper): self.load_external_result_data(os.path.join(TEST_PATH, 'Amazing Grace.json'))) self.file_import(os.path.join(TEST_PATH, 'Beautiful Garden Of Prayer.sbsong'), self.load_external_result_data(os.path.join(TEST_PATH, 'Beautiful Garden Of Prayer.json'))) + self.file_import(os.path.join(TEST_PATH, 'a mighty fortress is our god.sbsong'), + self.load_external_result_data(os.path.join(TEST_PATH, 'a mighty fortress is our god.json'))) class TestSongShowPlusImport(TestCase): diff --git a/tests/resources/songshowplussongs/a mighty fortress is our god.json b/tests/resources/songshowplussongs/a mighty fortress is our god.json new file mode 100644 index 000000000..7e3d400b4 --- /dev/null +++ b/tests/resources/songshowplussongs/a mighty fortress is our god.json @@ -0,0 +1,29 @@ +{ + "authors": [ + "Martin Luther" + ], + "comments": "", + "copyright": "Public Domain", + "song_number": 0, + "title": "A Mighty Fortress is our God", + "topics": [], + "verse_order_list": [], + "verses": [ + [ + "A mighty fortress is our God, a bulwark never failing;\r\nOur helper He, amid the flood of mortal ills prevailing:\r\nFor still our ancient foe doth seek to work us woe;\r\nHis craft and power are great, and, armed with cruel hate,\r\nOn earth is not his equal.\r\n", + "v1" + ], + [ + "Did we in our own strength confide, our striving would be losing;\r\nWere not the right Man on our side, the Man of God’s own choosing:\r\nDost ask who that may be? Christ Jesus, it is He;\r\nLord Sabaoth, His Name, from age to age the same,\r\nAnd He must win the battle.\r\n", + "v2" + ], + [ + "And though this world, with devils filled, should threaten to undo us,\r\nWe will not fear, for God hath willed His truth to triumph through us:\r\nThe Prince of Darkness grim, we tremble not for him;\r\nHis rage we can endure, for lo, his doom is sure,\r\nOne little word shall fell him.\r\n", + "v3" + ], + [ + "That word above all earthly powers, no thanks to them, abideth;\r\nThe Spirit and the gifts are ours through Him Who with us sideth:\r\nLet goods and kindred go, this mortal life also;\r\nThe body they may kill: God’s truth abideth still,\r\nHis kingdom is forever.\r\n", + "v4" + ] + ] +} \ No newline at end of file diff --git a/tests/resources/songshowplussongs/a mighty fortress is our god.sbsong b/tests/resources/songshowplussongs/a mighty fortress is our god.sbsong new file mode 100644 index 000000000..b66d52b2b Binary files /dev/null and b/tests/resources/songshowplussongs/a mighty fortress is our god.sbsong differ