forked from openlp/openlp
Fixes #1211913. The case of field names can change, so have taken that in to account by converting them to upper case
bzr-revno: 2154
This commit is contained in:
commit
c7b11e07c7
@ -68,7 +68,7 @@ class SundayPlusImport(SongImport):
|
|||||||
for filename in self.importSource:
|
for filename in self.importSource:
|
||||||
if self.stopImportFlag:
|
if self.stopImportFlag:
|
||||||
return
|
return
|
||||||
song_file = open(filename)
|
song_file = open(filename, 'rb')
|
||||||
self.doImportFile(song_file)
|
self.doImportFile(song_file)
|
||||||
song_file.close()
|
song_file.close()
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ class SundayPlusImport(SongImport):
|
|||||||
# Now we are looking for the name.
|
# Now we are looking for the name.
|
||||||
if data[i:i + 1] == '#':
|
if data[i:i + 1] == '#':
|
||||||
name_end = data.find(':', i + 1)
|
name_end = data.find(':', i + 1)
|
||||||
name = data[i + 1:name_end]
|
name = data[i + 1:name_end].upper()
|
||||||
i = name_end + 1
|
i = name_end + 1
|
||||||
while data[i:i + 1] == ' ':
|
while data[i:i + 1] == ' ':
|
||||||
i += 1
|
i += 1
|
||||||
@ -122,13 +122,13 @@ class SundayPlusImport(SongImport):
|
|||||||
value = data[i:end]
|
value = data[i:end]
|
||||||
# If we are in the main group.
|
# If we are in the main group.
|
||||||
if cell == False:
|
if cell == False:
|
||||||
if name == 'title':
|
if name == 'TITLE':
|
||||||
self.title = self.decode(self.unescape(value))
|
self.title = self.decode(self.unescape(value))
|
||||||
elif name == 'Author':
|
elif name == 'AUTHOR':
|
||||||
author = self.decode(self.unescape(value))
|
author = self.decode(self.unescape(value))
|
||||||
if len(author):
|
if len(author):
|
||||||
self.addAuthor(author)
|
self.addAuthor(author)
|
||||||
elif name == 'Copyright':
|
elif name == 'COPYRIGHT':
|
||||||
self.copyright = self.decode(self.unescape(value))
|
self.copyright = self.decode(self.unescape(value))
|
||||||
elif name[0:4] == 'CELL':
|
elif name[0:4] == 'CELL':
|
||||||
self.parse(value, cell = name[4:])
|
self.parse(value, cell = name[4:])
|
||||||
@ -142,13 +142,13 @@ class SundayPlusImport(SongImport):
|
|||||||
if len(value) >= 2 and value[-1] in ['0', '1', '2',
|
if len(value) >= 2 and value[-1] in ['0', '1', '2',
|
||||||
'3', '4', '5', '6', '7', '8', '9']:
|
'3', '4', '5', '6', '7', '8', '9']:
|
||||||
verse_type = "%s%s" % (verse_type, value[-1])
|
verse_type = "%s%s" % (verse_type, value[-1])
|
||||||
elif name == 'Hotkey':
|
elif name == 'HOTKEY':
|
||||||
# Hotkey always appears after MARKER_NAME, so it
|
# Hotkey always appears after MARKER_NAME, so it
|
||||||
# effectively overrides MARKER_NAME, if present.
|
# effectively overrides MARKER_NAME, if present.
|
||||||
if len(value) and \
|
if len(value) and \
|
||||||
value in HOTKEY_TO_VERSE_TYPE.keys():
|
value in HOTKEY_TO_VERSE_TYPE.keys():
|
||||||
verse_type = HOTKEY_TO_VERSE_TYPE[value]
|
verse_type = HOTKEY_TO_VERSE_TYPE[value]
|
||||||
if name == 'rtf':
|
if name == 'RTF':
|
||||||
value = self.unescape(value)
|
value = self.unescape(value)
|
||||||
result = strip_rtf(value, self.encoding)
|
result = strip_rtf(value, self.encoding)
|
||||||
if result is None:
|
if result is None:
|
||||||
|
Loading…
Reference in New Issue
Block a user