forked from openlp/openlp
New hints for AddSpaceAfterSemi and CCLI
This commit is contained in:
parent
36b5528d43
commit
0c1eb50312
@ -46,6 +46,7 @@ class SingingTheFaithImport(SongImport):
|
|||||||
hint_verse_order = ''
|
hint_verse_order = ''
|
||||||
hint_song_title = ''
|
hint_song_title = ''
|
||||||
hint_comments = ''
|
hint_comments = ''
|
||||||
|
hint_ccli = ''
|
||||||
hint_ignore_indent = False
|
hint_ignore_indent = False
|
||||||
|
|
||||||
def do_import(self):
|
def do_import(self):
|
||||||
@ -119,15 +120,13 @@ class SingingTheFaithImport(SongImport):
|
|||||||
line_number += 1
|
line_number += 1
|
||||||
if hints_available and str(line_number) in self.hint_line:
|
if hints_available and str(line_number) in self.hint_line:
|
||||||
hint = self.hint_line[str(line_number)]
|
hint = self.hint_line[str(line_number)]
|
||||||
|
# Set to false if this hint does not replace the line
|
||||||
|
line_replaced = True
|
||||||
if hint == 'Comment':
|
if hint == 'Comment':
|
||||||
line.strip()
|
line.strip()
|
||||||
self.add_comment(line)
|
self.add_comment(line)
|
||||||
line_number += 1
|
|
||||||
next(file)
|
|
||||||
continue
|
continue
|
||||||
elif hint == 'Ignore':
|
elif hint == 'Ignore':
|
||||||
line_number += 1
|
|
||||||
next(file)
|
|
||||||
continue
|
continue
|
||||||
elif hint == 'Author':
|
elif hint == 'Author':
|
||||||
# add as a raw author - do not split and make them a words author
|
# add as a raw author - do not split and make them a words author
|
||||||
@ -152,12 +151,17 @@ class SingingTheFaithImport(SongImport):
|
|||||||
line_number += 1
|
line_number += 1
|
||||||
next(file)
|
next(file)
|
||||||
continue
|
continue
|
||||||
|
elif hint == 'AddSpaceAfterSemi':
|
||||||
|
line = line.replace(';', '; ')
|
||||||
|
line_replaced = False
|
||||||
|
# note - do not use contine here as the line should now be processed as normal.
|
||||||
else:
|
else:
|
||||||
self.log_error(translate('SongsPlugin.SingingTheFaithImport',
|
self.log_error(translate('SongsPlugin.SingingTheFaithImport',
|
||||||
'File {file})'.format(file=file.name)),
|
'File {file})'.format(file=file.name)),
|
||||||
translate('SongsPlugin.SingingTheFaithImport',
|
translate('SongsPlugin.SingingTheFaithImport',
|
||||||
'Unknown hint {hint}').format(hint=hint))
|
'Unknown hint {hint}').format(hint=hint))
|
||||||
return
|
if line_replaced:
|
||||||
|
return
|
||||||
# STF exported lines have a leading verse number at the start of each verse.
|
# STF exported lines have a leading verse number at the start of each verse.
|
||||||
# remove them - note that we want to track the indent as that shows a chorus
|
# remove them - note that we want to track the indent as that shows a chorus
|
||||||
# so will deal with that before stipping all leading spaces.
|
# so will deal with that before stipping all leading spaces.
|
||||||
@ -179,8 +183,9 @@ class SingingTheFaithImport(SongImport):
|
|||||||
else:
|
else:
|
||||||
line = line.strip()
|
line = line.strip()
|
||||||
if line_number == 2:
|
if line_number == 2:
|
||||||
# note that songs seem to start with a blank line
|
# note that songs seem to start with a blank line so the title is line 2
|
||||||
song_title = line
|
# Also we strip blanks from the title, even if ignoring indent.
|
||||||
|
song_title = line.strip()
|
||||||
# Detect the 'Reproduced from Singing the Faith Electronic Words Edition' line
|
# Detect the 'Reproduced from Singing the Faith Electronic Words Edition' line
|
||||||
if line.startswith('Reproduced from Singing the Faith Electronic Words Edition'):
|
if line.startswith('Reproduced from Singing the Faith Electronic Words Edition'):
|
||||||
song_number_match = re.search(r'\d+', line)
|
song_number_match = re.search(r'\d+', line)
|
||||||
@ -282,6 +287,8 @@ class SingingTheFaithImport(SongImport):
|
|||||||
self.verse_order_list = self.hint_verse_order.split(',')
|
self.verse_order_list = self.hint_verse_order.split(',')
|
||||||
if self.hint_comments:
|
if self.hint_comments:
|
||||||
self.add_comment(self.hint_comments)
|
self.add_comment(self.hint_comments)
|
||||||
|
if self.hint_ccli:
|
||||||
|
self.ccli_number = self.hint_ccli
|
||||||
# Write the title last as by now we will know if we need checks
|
# Write the title last as by now we will know if we need checks
|
||||||
if hints_available and not self.checks_needed:
|
if hints_available and not self.checks_needed:
|
||||||
check_flag = ''
|
check_flag = ''
|
||||||
@ -300,6 +307,7 @@ class SingingTheFaithImport(SongImport):
|
|||||||
self.hint_comments = ''
|
self.hint_comments = ''
|
||||||
self.hint_song_title = ''
|
self.hint_song_title = ''
|
||||||
self.hint_ignore_indent = False
|
self.hint_ignore_indent = False
|
||||||
|
self.hint_ccli = ''
|
||||||
for tl in file:
|
for tl in file:
|
||||||
if not tl.strip():
|
if not tl.strip():
|
||||||
return hintfound
|
return hintfound
|
||||||
@ -332,6 +340,10 @@ class SingingTheFaithImport(SongImport):
|
|||||||
vals = val.split(',')
|
vals = val.split(',')
|
||||||
for v in vals:
|
for v in vals:
|
||||||
self.hint_line[v] = 'Author'
|
self.hint_line[v] = 'Author'
|
||||||
|
elif tag == 'AddSpaceAfterSemi':
|
||||||
|
vals = val.split(',')
|
||||||
|
for v in vals:
|
||||||
|
self.hint_line[v] = 'AddSpaceAfterSemi'
|
||||||
elif tag == 'VerseOrder':
|
elif tag == 'VerseOrder':
|
||||||
self.hint_verse_order = val
|
self.hint_verse_order = val
|
||||||
elif tag == 'ManualCheck':
|
elif tag == 'ManualCheck':
|
||||||
@ -345,6 +357,10 @@ class SingingTheFaithImport(SongImport):
|
|||||||
self.hint_song_title = val
|
self.hint_song_title = val
|
||||||
elif tag == 'AddComment':
|
elif tag == 'AddComment':
|
||||||
self.hint_comments += '\n' + val
|
self.hint_comments += '\n' + val
|
||||||
|
elif tag == 'CCLI':
|
||||||
|
self.hint_ccli = val
|
||||||
|
elif tag == 'Hymn':
|
||||||
|
self.log_error(file.name, 'Missing End tag in hint for Hymn: {}'.format(song_number))
|
||||||
else:
|
else:
|
||||||
self.log_error(file.name, 'Unknown tag {} value {}'.format(tag, val))
|
self.log_error(file.name, 'Unknown tag {} value {}'.format(tag, val))
|
||||||
return hintfound
|
return hintfound
|
||||||
|
Loading…
Reference in New Issue
Block a user