From a16fbda8d3c4710ccdf6e9b167bfab6e68c4934d Mon Sep 17 00:00:00 2001 From: Jonathan Corwin Date: Thu, 15 Mar 2012 22:38:03 +0000 Subject: [PATCH] Handle more songselect formats --- openlp/plugins/songs/lib/cclifileimport.py | 23 ++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/openlp/plugins/songs/lib/cclifileimport.py b/openlp/plugins/songs/lib/cclifileimport.py index 448e4bc37..6b99f9a16 100644 --- a/openlp/plugins/songs/lib/cclifileimport.py +++ b/openlp/plugins/songs/lib/cclifileimport.py @@ -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): 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,11 +327,17 @@ class CCLIFileImport(SongImport): #line_number=2, copyright if line_number == 2: line_number += 1 - self.copyright = clean_line + if clean_line.startswith(u'©'): + self.copyright = clean_line + else: + song_author = clean_line #n=3, authors elif line_number == 3: line_number += 1 - song_author = clean_line + 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'): self.comments += clean_line