forked from openlp/openlp
Fix for bug #762856.
bzr-revno: 1529 Fixes: https://launchpad.net/bugs/762856
This commit is contained in:
commit
71818097cd
@ -47,6 +47,7 @@ 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__)
|
||||||
|
|
||||||
@ -100,6 +101,7 @@ class SongShowPlusImport(SongImport):
|
|||||||
if not isinstance(self.import_source, list):
|
if not isinstance(self.import_source, list):
|
||||||
return
|
return
|
||||||
self.import_wizard.progressBar.setMaximum(len(self.import_source))
|
self.import_wizard.progressBar.setMaximum(len(self.import_source))
|
||||||
|
|
||||||
for file in self.import_source:
|
for file in self.import_source:
|
||||||
self.sspVerseOrderList = []
|
self.sspVerseOrderList = []
|
||||||
otherCount = 0
|
otherCount = 0
|
||||||
@ -108,13 +110,15 @@ class SongShowPlusImport(SongImport):
|
|||||||
self.import_wizard.incrementProgressBar(
|
self.import_wizard.incrementProgressBar(
|
||||||
WizardStrings.ImportingType % file_name, 0)
|
WizardStrings.ImportingType % file_name, 0)
|
||||||
songData = open(file, 'rb')
|
songData = open(file, 'rb')
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
blockKey, = struct.unpack("I", songData.read(4))
|
blockKey, = struct.unpack("I", songData.read(4))
|
||||||
# The file ends with 4 NUL's
|
# The file ends with 4 NUL's
|
||||||
if blockKey == 0:
|
if blockKey == 0:
|
||||||
break
|
break
|
||||||
nextBlockStarts, = struct.unpack("I", songData.read(4))
|
nextBlockStarts, = struct.unpack("I", songData.read(4))
|
||||||
if blockKey == VERSE or blockKey == CHORUS:
|
nextBlockStarts += songData.tell()
|
||||||
|
if blockKey in (VERSE, CHORUS, BRIDGE):
|
||||||
null, verseNo, = struct.unpack("BB", songData.read(2))
|
null, verseNo, = struct.unpack("BB", songData.read(2))
|
||||||
elif blockKey == CUSTOM_VERSE:
|
elif blockKey == CUSTOM_VERSE:
|
||||||
null, verseNameLength, = struct.unpack("BB",
|
null, verseNameLength, = struct.unpack("BB",
|
||||||
@ -150,6 +154,9 @@ class SongShowPlusImport(SongImport):
|
|||||||
elif blockKey == CHORUS:
|
elif blockKey == CHORUS:
|
||||||
self.add_verse(unicode(data, u'cp1252'),
|
self.add_verse(unicode(data, u'cp1252'),
|
||||||
"C%s" % verseNo)
|
"C%s" % verseNo)
|
||||||
|
elif blockKey == BRIDGE:
|
||||||
|
self.add_verse(unicode(data, u'cp1252'),
|
||||||
|
"B%s" % verseNo)
|
||||||
elif blockKey == TOPIC:
|
elif blockKey == TOPIC:
|
||||||
self.topics.append(unicode(data, u'cp1252'))
|
self.topics.append(unicode(data, u'cp1252'))
|
||||||
elif blockKey == COMMENTS:
|
elif blockKey == COMMENTS:
|
||||||
@ -169,6 +176,7 @@ class SongShowPlusImport(SongImport):
|
|||||||
else:
|
else:
|
||||||
log.debug("Unrecognised blockKey: %s, data: %s"
|
log.debug("Unrecognised blockKey: %s, data: %s"
|
||||||
% (blockKey, data))
|
% (blockKey, data))
|
||||||
|
songData.seek(nextBlockStarts)
|
||||||
self.verse_order_list = self.sspVerseOrderList
|
self.verse_order_list = self.sspVerseOrderList
|
||||||
songData.close()
|
songData.close()
|
||||||
if not self.finish():
|
if not self.finish():
|
||||||
|
Loading…
Reference in New Issue
Block a user