forked from openlp/openlp
fixes bug 1098075 trunk version
This commit is contained in:
parent
c28448d18c
commit
17252dafd2
@ -571,6 +571,8 @@ def strip_rtf(text, default_encoding=None):
|
|||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
encoding, default_encoding = get_encoding(font, font_table, default_encoding, failed=failed)
|
encoding, default_encoding = get_encoding(font, font_table, default_encoding, failed=failed)
|
||||||
|
if not encoding:
|
||||||
|
return None
|
||||||
out.append(chr(charcode).decode(encoding))
|
out.append(chr(charcode).decode(encoding))
|
||||||
except UnicodeDecodeError:
|
except UnicodeDecodeError:
|
||||||
failed = True
|
failed = True
|
||||||
|
@ -174,7 +174,10 @@ class EasyWorshipSongImport(SongImport):
|
|||||||
self.addAuthor(author_name.strip())
|
self.addAuthor(author_name.strip())
|
||||||
if words:
|
if words:
|
||||||
# Format the lyrics
|
# Format the lyrics
|
||||||
words, self.encoding = strip_rtf(words, self.encoding)
|
result = strip_rtf(words, self.encoding)
|
||||||
|
if result is None:
|
||||||
|
return
|
||||||
|
words, self.encoding = result
|
||||||
verse_type = VerseType.Tags[VerseType.Verse]
|
verse_type = VerseType.Tags[VerseType.Verse]
|
||||||
for verse in SLIDE_BREAK_REGEX.split(words):
|
for verse in SLIDE_BREAK_REGEX.split(words):
|
||||||
verse = verse.strip()
|
verse = verse.strip()
|
||||||
|
@ -107,7 +107,10 @@ class SongProImport(SongImport):
|
|||||||
self.finish()
|
self.finish()
|
||||||
return
|
return
|
||||||
if u'rtf1' in text:
|
if u'rtf1' in text:
|
||||||
text, self.encoding = strip_rtf(text, self.encoding)
|
result = strip_rtf(text, self.encoding)
|
||||||
|
if result is None:
|
||||||
|
return
|
||||||
|
text, self.encoding = result
|
||||||
text = text.rstrip()
|
text = text.rstrip()
|
||||||
if not text:
|
if not text:
|
||||||
return
|
return
|
||||||
|
@ -148,7 +148,10 @@ class SundayPlusImport(SongImport):
|
|||||||
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)
|
||||||
verse, self.encoding = strip_rtf(value, self.encoding)
|
result = strip_rtf(value, self.encoding)
|
||||||
|
if result is None:
|
||||||
|
return
|
||||||
|
verse, self.encoding = result
|
||||||
lines = verse.strip().split('\n')
|
lines = verse.strip().split('\n')
|
||||||
# If any line inside any verse contains CCLI or
|
# If any line inside any verse contains CCLI or
|
||||||
# only Public Domain, we treat this as special data:
|
# only Public Domain, we treat this as special data:
|
||||||
|
Loading…
Reference in New Issue
Block a user