forked from openlp/openlp
clean ups
This commit is contained in:
parent
baff5451c2
commit
41f0be38fb
@ -37,9 +37,9 @@ log = logging.getLogger(__name__)
|
|||||||
|
|
||||||
class CCLIFileImport(SongImport):
|
class CCLIFileImport(SongImport):
|
||||||
"""
|
"""
|
||||||
The :class:`CCLIFileImport` class provides OpenLP with the ability to
|
The :class:`CCLIFileImport` class provides OpenLP with the ability to import
|
||||||
import CCLI SongSelect song files in both .txt and .usr formats.
|
CCLI SongSelect song files in both .txt and .usr formats. See
|
||||||
See http://www.ccli.com/ for more details.
|
`<http://www.ccli.com/>`_ for more details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, manager, **kwargs):
|
def __init__(self, manager, **kwargs):
|
||||||
@ -56,7 +56,7 @@ class CCLIFileImport(SongImport):
|
|||||||
|
|
||||||
def do_import(self):
|
def do_import(self):
|
||||||
"""
|
"""
|
||||||
Import either a .usr or a .txt SongSelect file
|
Import either a ``.usr`` or a ``.txt`` SongSelect file.
|
||||||
"""
|
"""
|
||||||
log.debug(u'Starting CCLI File Import')
|
log.debug(u'Starting CCLI File Import')
|
||||||
song_total = len(self.import_source)
|
song_total = len(self.import_source)
|
||||||
@ -83,12 +83,10 @@ class CCLIFileImport(SongImport):
|
|||||||
lines = infile.readlines()
|
lines = infile.readlines()
|
||||||
ext = os.path.splitext(filename)[1]
|
ext = os.path.splitext(filename)[1]
|
||||||
if ext.lower() == u'.usr':
|
if ext.lower() == u'.usr':
|
||||||
log.info(u'SongSelect .usr format file found %s: ',
|
log.info(u'SongSelect .usr format file found: %s', filename)
|
||||||
filename)
|
|
||||||
self.do_import_usr_file(lines)
|
self.do_import_usr_file(lines)
|
||||||
elif ext.lower() == u'.txt':
|
elif ext.lower() == u'.txt':
|
||||||
log.info(u'SongSelect .txt format file found %s: ',
|
log.info(u'SongSelect .txt format file found: %s', filename)
|
||||||
filename)
|
|
||||||
self.do_import_txt_file(lines)
|
self.do_import_txt_file(lines)
|
||||||
else:
|
else:
|
||||||
log.info(u'Extension %s is not valid', filename)
|
log.info(u'Extension %s is not valid', filename)
|
||||||
@ -99,9 +97,8 @@ class CCLIFileImport(SongImport):
|
|||||||
|
|
||||||
def do_import_usr_file(self, textList):
|
def do_import_usr_file(self, textList):
|
||||||
"""
|
"""
|
||||||
The :func:`do_import_usr_file` method provides OpenLP
|
The :func:`do_import_usr_file` method provides OpenLP with the ability
|
||||||
with the ability to import CCLI SongSelect songs in
|
to import CCLI SongSelect songs in *USR* file format.
|
||||||
*USR* file format
|
|
||||||
|
|
||||||
``textList``
|
``textList``
|
||||||
An array of strings containing the usr file content.
|
An array of strings containing the usr file content.
|
||||||
@ -225,9 +222,8 @@ class CCLIFileImport(SongImport):
|
|||||||
|
|
||||||
def do_import_txt_file(self, textList):
|
def do_import_txt_file(self, textList):
|
||||||
"""
|
"""
|
||||||
The :func:`do_import_txt_file` method provides OpenLP
|
The :func:`do_import_txt_file` method provides OpenLP with the ability
|
||||||
with the ability to import CCLI SongSelect songs in
|
to import CCLI SongSelect songs in *TXT* file format.
|
||||||
*TXT* file format
|
|
||||||
|
|
||||||
``textList``
|
``textList``
|
||||||
An array of strings containing the txt file content.
|
An array of strings containing the txt file content.
|
||||||
@ -261,7 +257,6 @@ class CCLIFileImport(SongImport):
|
|||||||
check_first_verse_line = False
|
check_first_verse_line = False
|
||||||
verse_text = u''
|
verse_text = u''
|
||||||
song_author = u''
|
song_author = u''
|
||||||
song_topics = u''
|
|
||||||
verse_start = False
|
verse_start = False
|
||||||
for line in textList:
|
for line in textList:
|
||||||
clean_line = line.strip()
|
clean_line = line.strip()
|
||||||
@ -296,8 +291,8 @@ class CCLIFileImport(SongImport):
|
|||||||
elif verse_desc_parts[0].startswith(u'Br'):
|
elif verse_desc_parts[0].startswith(u'Br'):
|
||||||
verse_type = VerseType.Tags[VerseType.Bridge]
|
verse_type = VerseType.Tags[VerseType.Bridge]
|
||||||
else:
|
else:
|
||||||
#we need to analyse the next line for
|
# we need to analyse the next line for
|
||||||
#verse type, so set flag
|
# verse type, so set flag
|
||||||
verse_type = VerseType.Tags[VerseType.Other]
|
verse_type = VerseType.Tags[VerseType.Other]
|
||||||
check_first_verse_line = True
|
check_first_verse_line = True
|
||||||
verse_number = verse_desc_parts[1]
|
verse_number = verse_desc_parts[1]
|
||||||
@ -306,7 +301,7 @@ class CCLIFileImport(SongImport):
|
|||||||
verse_number = 1
|
verse_number = 1
|
||||||
verse_start = True
|
verse_start = True
|
||||||
else:
|
else:
|
||||||
#check first line for verse type
|
# check first line for verse type
|
||||||
if check_first_verse_line:
|
if check_first_verse_line:
|
||||||
if line.startswith(u'(PRE-CHORUS'):
|
if line.startswith(u'(PRE-CHORUS'):
|
||||||
verse_type = VerseType.Tags[VerseType.PreChorus]
|
verse_type = VerseType.Tags[VerseType.PreChorus]
|
||||||
|
Loading…
Reference in New Issue
Block a user