Song Import Wizard - bugs

bzr-revno: 2134
This commit is contained in:
Philip Ridout 2013-02-18 21:16:08 +00:00 committed by Tim Bentley
commit 4f27b62543
2 changed files with 15 additions and 7 deletions

View File

@ -268,6 +268,7 @@ class SongImport(QtCore.QObject):
elif int(verse_def[1:]) > self.verseCounts[verse_def[0]]: elif int(verse_def[1:]) > self.verseCounts[verse_def[0]]:
self.verseCounts[verse_def[0]] = int(verse_def[1:]) self.verseCounts[verse_def[0]] = int(verse_def[1:])
self.verses.append([verse_def, verse_text.rstrip(), lang]) self.verses.append([verse_def, verse_text.rstrip(), lang])
if verse_def not in self.verseOrderListGenerated:
self.verseOrderListGenerated.append(verse_def) self.verseOrderListGenerated.append(verse_def)
def repeatVerse(self): def repeatVerse(self):

View File

@ -32,6 +32,7 @@ SongShow Plus songs into the OpenLP database.
""" """
import os import os
import logging import logging
import re
import struct import struct
from openlp.core.ui.wizard import WizardStrings from openlp.core.ui.wizard import WizardStrings
@ -44,13 +45,13 @@ COPYRIGHT = 3
CCLI_NO = 5 CCLI_NO = 5
VERSE = 12 VERSE = 12
CHORUS = 20 CHORUS = 20
BRIDGE = 24
TOPIC = 29 TOPIC = 29
COMMENTS = 30 COMMENTS = 30
VERSE_ORDER = 31 VERSE_ORDER = 31
SONG_BOOK = 35 SONG_BOOK = 35
SONG_NUMBER = 36 SONG_NUMBER = 36
CUSTOM_VERSE = 37 CUSTOM_VERSE = 37
BRIDGE = 24
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -189,13 +190,19 @@ class SongShowPlusImport(SongImport):
self.logError(file) self.logError(file)
def toOpenLPVerseTag(self, verse_name, ignore_unique=False): def toOpenLPVerseTag(self, verse_name, ignore_unique=False):
if verse_name.find(" ") != -1: # have we got any digits?
verse_parts = verse_name.split(" ") # If so, verse number is everything from the digits
verse_type = verse_parts[0] # to the end (openlp does not have concept of part verses, so
verse_number = verse_parts[1] # just ignore any non integers on the end (including floats))
match = re.match(u'(\D*)(\d+)', verse_name)
if match:
verse_type = match.group(1).strip()
verse_number = match.group(2)
else: else:
# otherwise we assume number 1 and take the whole prefix as
# the verse tag
verse_type = verse_name verse_type = verse_name
verse_number = "1" verse_number = u'1'
verse_type = verse_type.lower() verse_type = verse_type.lower()
if verse_type == "verse": if verse_type == "verse":
verse_tag = VerseType.Tags[VerseType.Verse] verse_tag = VerseType.Tags[VerseType.Verse]