openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #23430
[Merge] lp:~sam92/openlp/bug-1310623 into lp:openlp
Samuel Mehrbrodt has proposed merging lp:~sam92/openlp/bug-1310623 into lp:openlp.
Requested reviews:
Andreas Preikschat (googol)
Raoul Snyman (raoul-snyman)
Related bugs:
Bug #1310623 in OpenLP: "SongShowPlus Import fails when CCLI number has text in it"
https://bugs.launchpad.net/openlp/+bug/1310623
For more details, see:
https://code.launchpad.net/~sam92/openlp/bug-1310623/+merge/218181
Fix SongShowPlus Import when CCLI number contains text
lp:~sam92/openlp/bug-1310623 (revision 2374)
[SUCCESS] http://ci.openlp.org/job/Branch-01-Pull/424/
[SUCCESS] http://ci.openlp.org/job/Branch-02-Functional-Tests/380/
[SUCCESS] http://ci.openlp.org/job/Branch-03-Interface-Tests/325/
[SUCCESS] http://ci.openlp.org/job/Branch-04-Windows_Tests/286/
[SUCCESS] http://ci.openlp.org/job/Branch-05a-Code_Analysis/192/
[SUCCESS] http://ci.openlp.org/job/Branch-05b-Test_Coverage/67/
--
https://code.launchpad.net/~sam92/openlp/bug-1310623/+merge/218181
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/plugins/songs/lib/songshowplusimport.py'
--- openlp/plugins/songs/lib/songshowplusimport.py 2014-03-29 13:31:28 +0000
+++ openlp/plugins/songs/lib/songshowplusimport.py 2014-05-03 08:55:44 +0000
@@ -121,7 +121,7 @@
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 @@
elif block_key == COPYRIGHT:
self.add_copyright(self.decode(data))
elif block_key == CCLI_NO:
- self.ccli_number = int(data)
+ # Try to get the CCLI number even if the field contains additional text
+ match = re.search(r'\d+', self.decode(data))
+ if match:
+ self.ccli_number = int(match.group())
elif block_key == VERSE:
self.add_verse(self.decode(data), "%s%s" % (VerseType.tags[VerseType.Verse], verse_no))
elif block_key == CHORUS:
=== modified file 'tests/functional/openlp_plugins/songs/test_songshowplusimport.py'
--- tests/functional/openlp_plugins/songs/test_songshowplusimport.py 2014-04-20 20:19:21 +0000
+++ tests/functional/openlp_plugins/songs/test_songshowplusimport.py 2014-05-03 08:55:44 +0000
@@ -57,6 +57,8 @@
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):
=== added file 'tests/resources/songshowplussongs/a mighty fortress is our god.json'
--- tests/resources/songshowplussongs/a mighty fortress is our god.json 1970-01-01 00:00:00 +0000
+++ tests/resources/songshowplussongs/a mighty fortress is our god.json 2014-05-03 08:55:44 +0000
@@ -0,0 +1,31 @@
+{
+ "authors": [
+ "Martin Luther"
+ ],
+ "ccli_number": 12456,
+ "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"
+ ]
+ ]
+}
+
=== added file 'tests/resources/songshowplussongs/a mighty fortress is our god.sbsong'
Binary files tests/resources/songshowplussongs/a mighty fortress is our god.sbsong 1970-01-01 00:00:00 +0000 and tests/resources/songshowplussongs/a mighty fortress is our god.sbsong 2014-05-03 08:55:44 +0000 differ
Follow ups