forked from openlp/openlp
Updated to handle CCLI verse type 'misc'
This commit is contained in:
parent
1b3db9f429
commit
a5fc219abb
@ -165,6 +165,7 @@ class CCLIFileImport(SongImport):
|
||||
song_words = line[6:].strip()
|
||||
#Unhandled usr keywords:Type,Version,Admin,Themes,Keys
|
||||
#Process Fields and words sections
|
||||
check_first_verse_line = False
|
||||
field_list = song_fields.split(u'/t')
|
||||
words_list = song_words.split(u'/t')
|
||||
for counter in range(0, len(field_list)):
|
||||
@ -176,10 +177,25 @@ class CCLIFileImport(SongImport):
|
||||
verse_type = u'B'
|
||||
else: #Other
|
||||
verse_type = u'O'
|
||||
check_first_verse_line = True
|
||||
verse_text = unicode(words_list[counter])
|
||||
verse_text = verse_text.replace("/n", "\n")
|
||||
verse_lines = verse_text.split(u'\n', 1)
|
||||
if check_first_verse_line:
|
||||
if verse_lines[0].startswith(u'(PRE-CHORUS'):
|
||||
verse_type = u'P'
|
||||
log.debug(u'USR verse PRE-CHORUS: %s', verse_lines[0] )
|
||||
verse_text = verse_lines[1]
|
||||
elif verse_lines[0].startswith(u'(BRIDGE'):
|
||||
verse_type = u'B'
|
||||
log.debug(u'USR verse BRIDGE')
|
||||
verse_text = verse_lines[1]
|
||||
elif verse_lines[0].startswith(u'('):
|
||||
verse_type = u'O'
|
||||
verse_text = verse_lines[1]
|
||||
if len(verse_text) > 0:
|
||||
self.add_verse(verse_text, verse_type)
|
||||
check_first_verse_line = False
|
||||
#Handle multiple authors
|
||||
author_list = song_author.split(u'/')
|
||||
if len(author_list) < 2:
|
||||
@ -228,6 +244,7 @@ class CCLIFileImport(SongImport):
|
||||
log.debug(u'TXT file text: %s', textList)
|
||||
self.set_defaults()
|
||||
line_number = 0
|
||||
check_first_verse_line = False
|
||||
verse_text = u''
|
||||
song_comments = u''
|
||||
song_copyright = u''
|
||||
@ -265,12 +282,28 @@ class CCLIFileImport(SongImport):
|
||||
elif verse_desc_parts[0].startswith(u'Br'):
|
||||
verse_type = u'B'
|
||||
else:
|
||||
#we need to analyse the next line for
|
||||
#verse type, so set flag
|
||||
verse_type = u'O'
|
||||
check_first_verse_line = True
|
||||
verse_number = verse_desc_parts[1]
|
||||
else:
|
||||
verse_type = u'O'
|
||||
verse_number = 1
|
||||
verse_start = True
|
||||
else:
|
||||
#check first line for verse type
|
||||
if check_first_verse_line:
|
||||
if line.startswith(u'(PRE-CHORUS'):
|
||||
verse_type = u'P'
|
||||
elif line.startswith(u'(BRIDGE'):
|
||||
verse_type = u'B'
|
||||
# Handle all other misc types
|
||||
elif line.startswith(u'('):
|
||||
verse_type = u'O'
|
||||
else:
|
||||
verse_text = verse_text + line
|
||||
check_first_verse_line = False
|
||||
else:
|
||||
# We have verse content or the start of the
|
||||
# last part. Add l so as to keep the CRLF
|
||||
|
Loading…
Reference in New Issue
Block a user