Fix a few songselect import file format issues

bzr-revno: 1906
This commit is contained in:
Jonathan Corwin 2012-03-16 18:59:21 +00:00
commit 3c2fa992b8

View File

@ -159,6 +159,12 @@ class CCLIFileImport(SongImport):
song_author = u''
song_topics = u''
for line in textList:
if line.startswith(u'[S '):
ccli, line = line.split(u']', 1)
if ccli.startswith(u'[S A'):
self.ccliNumber = ccli[4:].strip()
else:
self.ccliNumber = ccli[3:].strip()
if line.startswith(u'Title='):
self.title = line[6:].strip()
elif line.startswith(u'Author='):
@ -166,9 +172,7 @@ class CCLIFileImport(SongImport):
elif line.startswith(u'Copyright='):
self.copyright = line[10:].strip()
elif line.startswith(u'Themes='):
song_topics = line[7:].strip()
elif line.startswith(u'[S A'):
self.ccliNumber = line[4:-3].strip()
song_topics = line[7:].strip().replace(u' | ', u'/t')
elif line.startswith(u'Fields='):
# Fields contain single line indicating verse, chorus, etc,
# /t delimited, same as with words field. store seperately
@ -193,6 +197,7 @@ class CCLIFileImport(SongImport):
check_first_verse_line = True
verse_text = unicode(words_list[counter])
verse_text = verse_text.replace(u'/n', u'\n')
verse_text = verse_text.replace(u' | ', u'\n')
verse_lines = verse_text.split(u'\n', 1)
if check_first_verse_line:
if verse_lines[0].startswith(u'(PRE-CHORUS'):
@ -243,7 +248,7 @@ class CCLIFileImport(SongImport):
<Empty line>
Song CCLI number
# e.g. CCLI Number (e.g.CCLI-Liednummer: 2672885)
Song copyright
Song copyright (if it begins ©, otherwise after authors)
# e.g. © 1999 Integrity's Hosanna! Music | LenSongs Publishing
Song authors # e.g. Lenny LeBlanc | Paul Baloche
Licencing info
@ -322,10 +327,16 @@ class CCLIFileImport(SongImport):
#line_number=2, copyright
if line_number == 2:
line_number += 1
if clean_line.startswith(u'©'):
self.copyright = clean_line
else:
song_author = clean_line
#n=3, authors
elif line_number == 3:
line_number += 1
if song_author:
self.copyright = clean_line
else:
song_author = clean_line
#line_number=4, comments lines before last line
elif line_number == 4 and not clean_line.startswith(u'CCL'):