openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #19447
[Merge] lp:~phill-ridout/openlp/bug1125956_2.0 into lp:openlp/2.0
Phill has proposed merging lp:~phill-ridout/openlp/bug1125956_2.0 into lp:openlp/2.0.
Requested reviews:
OpenLP Core (openlp-core)
Related bugs:
Bug #1125956 in OpenLP: "SongShowPlus importer does not handle verse labels such as 1A"
https://bugs.launchpad.net/openlp/+bug/1125956
For more details, see:
https://code.launchpad.net/~phill-ridout/openlp/bug1125956_2.0/+merge/148954
A trunk version is in the works, but I cannot test it, or complete the unittests until Bug #1116528 has been fixed
--
https://code.launchpad.net/~phill-ridout/openlp/bug1125956_2.0/+merge/148954
Your team OpenLP Core is requested to review the proposed merge of lp:~phill-ridout/openlp/bug1125956_2.0 into lp:openlp/2.0.
=== modified file 'openlp/plugins/songs/lib/songimport.py'
--- openlp/plugins/songs/lib/songimport.py 2012-12-30 19:41:24 +0000
+++ openlp/plugins/songs/lib/songimport.py 2013-02-17 19:55:24 +0000
@@ -268,7 +268,8 @@
elif int(verse_def[1:]) > self.verseCounts[verse_def[0]]:
self.verseCounts[verse_def[0]] = int(verse_def[1:])
self.verses.append([verse_def, verse_text.rstrip(), lang])
- self.verseOrderListGenerated.append(verse_def)
+ if verse_def not in self.verseOrderListGenerated:
+ self.verseOrderListGenerated.append(verse_def)
def repeatVerse(self):
"""
=== modified file 'openlp/plugins/songs/lib/songshowplusimport.py'
--- openlp/plugins/songs/lib/songshowplusimport.py 2012-12-30 19:41:24 +0000
+++ openlp/plugins/songs/lib/songshowplusimport.py 2013-02-17 19:55:24 +0000
@@ -32,6 +32,7 @@
"""
import os
import logging
+import re
import struct
from openlp.core.ui.wizard import WizardStrings
@@ -44,13 +45,13 @@
CCLI_NO = 5
VERSE = 12
CHORUS = 20
+BRIDGE = 24
TOPIC = 29
COMMENTS = 30
VERSE_ORDER = 31
SONG_BOOK = 35
SONG_NUMBER = 36
CUSTOM_VERSE = 37
-BRIDGE = 24
log = logging.getLogger(__name__)
@@ -189,13 +190,19 @@
self.logError(file)
def toOpenLPVerseTag(self, verse_name, ignore_unique=False):
- if verse_name.find(" ") != -1:
- verse_parts = verse_name.split(" ")
- verse_type = verse_parts[0]
- verse_number = verse_parts[1]
+ # have we got any digits?
+ # If so, verse number is everything from the digits
+ # to the end (openlp does not have concept of part verses, so
+ # just ignore any non integers on the end (including floats))
+ match = re.match(u'(\D*)(\d+)', verse_name)
+ if match is not None:
+ verse_type = match.group(1).strip()
+ verse_number = match.group(2)
else:
+ # otherwise we assume number 1 and take the whole prefix as
+ # the verse tag
verse_type = verse_name
- verse_number = "1"
+ verse_number = u'1'
verse_type = verse_type.lower()
if verse_type == "verse":
verse_tag = VerseType.Tags[VerseType.Verse]
Follow ups