forked from openlp/openlp
Fix SongShowPlus Import for certain cases
Fixes: https://launchpad.net/bugs/1310623
This commit is contained in:
parent
20f748d608
commit
bdf3109aaa
@ -121,7 +121,7 @@ class SongShowPlusImport(SongImport):
|
|||||||
null, verse_no, = struct.unpack("BB", song_data.read(2))
|
null, verse_no, = struct.unpack("BB", song_data.read(2))
|
||||||
elif block_key == CUSTOM_VERSE:
|
elif block_key == CUSTOM_VERSE:
|
||||||
null, verse_name_length, = struct.unpack("BB", song_data.read(2))
|
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))
|
length_descriptor_size, = struct.unpack("B", song_data.read(1))
|
||||||
log.debug(length_descriptor_size)
|
log.debug(length_descriptor_size)
|
||||||
# Detect if/how long the length descriptor is
|
# Detect if/how long the length descriptor is
|
||||||
@ -147,7 +147,10 @@ class SongShowPlusImport(SongImport):
|
|||||||
elif block_key == COPYRIGHT:
|
elif block_key == COPYRIGHT:
|
||||||
self.add_copyright(self.decode(data))
|
self.add_copyright(self.decode(data))
|
||||||
elif block_key == CCLI_NO:
|
elif block_key == CCLI_NO:
|
||||||
self.ccli_number = int(data)
|
try:
|
||||||
|
self.ccli_number = int(data)
|
||||||
|
except ValueError:
|
||||||
|
continue
|
||||||
elif block_key == VERSE:
|
elif block_key == VERSE:
|
||||||
self.add_verse(self.decode(data), "%s%s" % (VerseType.tags[VerseType.Verse], verse_no))
|
self.add_verse(self.decode(data), "%s%s" % (VerseType.tags[VerseType.Verse], verse_no))
|
||||||
elif block_key == CHORUS:
|
elif block_key == CHORUS:
|
||||||
|
@ -57,6 +57,8 @@ class TestSongShowPlusFileImport(SongImportTestHelper):
|
|||||||
self.load_external_result_data(os.path.join(TEST_PATH, 'Amazing Grace.json')))
|
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.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.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):
|
class TestSongShowPlusImport(TestCase):
|
||||||
|
@ -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"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
}
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user