forked from openlp/openlp
improved copyright text handling and restructed a bit.
This commit is contained in:
parent
7b69634552
commit
7941d8e2a1
@ -94,7 +94,11 @@ class OpsProImport(SongImport):
|
||||
self.set_defaults()
|
||||
self.title = song.Title
|
||||
if song.CopyrightText:
|
||||
self.parse_author(song.CopyrightText)
|
||||
for line in song.CopyrightText.splitlines():
|
||||
if line.startswith('©') or line.lower().startswith('copyright'):
|
||||
self.add_copyright(line)
|
||||
else:
|
||||
self.parse_author(line)
|
||||
if song.Origin:
|
||||
self.comments = song.Origin
|
||||
if song.SongBookName:
|
||||
@ -147,6 +151,19 @@ class OpsProImport(SongImport):
|
||||
verse_text = re.sub('\[split\]', '\r\n[---]', verse_text)
|
||||
# Handle translations
|
||||
if lyrics.IsDualLanguage:
|
||||
verse_text = self.handle_translation(verse_text)
|
||||
# Remove comments
|
||||
verse_text = re.sub('\(.*?\)\r\n', '', verse_text, flags=re.IGNORECASE)
|
||||
self.add_verse(verse_text, verse_def)
|
||||
self.finish()
|
||||
|
||||
def handle_translation(self, verse_text):
|
||||
"""
|
||||
Replace OPS Pro translation tags with a {translation} tag
|
||||
|
||||
:param verse_text: the verse text
|
||||
:return: the verse text with replaced tags
|
||||
"""
|
||||
language = None
|
||||
translation = True
|
||||
translation_verse_text = ''
|
||||
@ -190,11 +207,7 @@ class OpsProImport(SongImport):
|
||||
while idx < len(verse_text_lines) and not verse_text_lines[idx].startswith('['):
|
||||
translation_verse_text += verse_text_lines[idx] + '\r\n'
|
||||
idx += 1
|
||||
verse_text = translation_verse_text
|
||||
# Remove comments
|
||||
verse_text = re.sub('\(.*?\)\r\n', '', verse_text, flags=re.IGNORECASE)
|
||||
self.add_verse(verse_text, verse_def)
|
||||
self.finish()
|
||||
return translation_verse_text
|
||||
|
||||
def extract_mdb_password(self):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user