forked from openlp/openlp
Fix EasyWorship import issues with missing verses and traceback on unknown chars.
Fixes: https://launchpad.net/bugs/1553922, https://launchpad.net/bugs/1547234
This commit is contained in:
parent
4b57a2bae6
commit
1dfad12edc
@ -289,6 +289,7 @@ class EasyWorshipSongImport(SongImport):
|
||||
for i in range(rec_count):
|
||||
if self.stop_import_flag:
|
||||
break
|
||||
try:
|
||||
raw_record = db_file.read(record_size)
|
||||
self.fields = self.record_structure.unpack(raw_record)
|
||||
self.set_defaults()
|
||||
@ -323,6 +324,10 @@ class EasyWorshipSongImport(SongImport):
|
||||
self.entry_error_log = ''
|
||||
elif not self.finish():
|
||||
self.log_error(self.import_source)
|
||||
except Exception as e:
|
||||
self.log_error(self.import_source,
|
||||
translate('SongsPlugin.EasyWorshipSongImport', '"%s" could not be imported. %s')
|
||||
% (self.title, e))
|
||||
db_file.close()
|
||||
self.memo_file.close()
|
||||
|
||||
@ -368,7 +373,7 @@ class EasyWorshipSongImport(SongImport):
|
||||
first_line_is_tag = False
|
||||
# EW tags: verse, chorus, pre-chorus, bridge, tag,
|
||||
# intro, ending, slide
|
||||
for tag in VerseType.tags + ['tag', 'slide']:
|
||||
for tag in VerseType.names + ['tag', 'slide', 'end']:
|
||||
tag = tag.lower()
|
||||
ew_tag = verse_split[0].strip().lower()
|
||||
if ew_tag.startswith(tag):
|
||||
@ -390,6 +395,9 @@ class EasyWorshipSongImport(SongImport):
|
||||
if not number_found:
|
||||
verse_type += '1'
|
||||
break
|
||||
# If the verse only consist of the tag-line, add an empty line to create an empty slide
|
||||
if first_line_is_tag and len(verse_split) == 1:
|
||||
verse_split.append("")
|
||||
self.add_verse(verse_split[-1].strip() if first_line_is_tag else verse, verse_type)
|
||||
if len(self.comments) > 5:
|
||||
self.comments += str(translate('SongsPlugin.EasyWorshipSongImport',
|
||||
|
Loading…
Reference in New Issue
Block a user