forked from openlp/openlp
longer variable names
This commit is contained in:
parent
cd431652ca
commit
04a90fe42b
@ -210,8 +210,8 @@ class OpenSongImport(SongImport):
|
|||||||
# keep track of verses appearance order
|
# keep track of verses appearance order
|
||||||
our_verse_order = []
|
our_verse_order = []
|
||||||
# default versetype
|
# default versetype
|
||||||
vt = u'V'
|
versetype = u'V'
|
||||||
vn = u'1'
|
versenum = u'1'
|
||||||
# for the case where song has several sections with same marker
|
# for the case where song has several sections with same marker
|
||||||
inst = 1
|
inst = 1
|
||||||
lyrics = unicode(root.lyrics)
|
lyrics = unicode(root.lyrics)
|
||||||
@ -237,40 +237,41 @@ class OpenSongImport(SongImport):
|
|||||||
# to the end (even if there are some alpha chars on the end)
|
# to the end (even if there are some alpha chars on the end)
|
||||||
match = re.match(u'(.*)(\d+.*)', content)
|
match = re.match(u'(.*)(\d+.*)', content)
|
||||||
if match is not None:
|
if match is not None:
|
||||||
vt = match.group(1)
|
versetype = match.group(1)
|
||||||
vn = match.group(2)
|
versenum = match.group(2)
|
||||||
else:
|
else:
|
||||||
# otherwise we assume number 1 and take the whole prefix as
|
# otherwise we assume number 1 and take the whole prefix as
|
||||||
# the versetype
|
# the versetype
|
||||||
vt = content
|
versetype = content
|
||||||
vn = u'1'
|
versenum = u'1'
|
||||||
inst = 1
|
inst = 1
|
||||||
if [vt, vn, inst] in our_verse_order and verses.has_key(vt) \
|
if [versetype, versenum, inst] in our_verse_order \
|
||||||
and verses[vt].has_key(vn):
|
and verses.has_key(versetype) \
|
||||||
inst = len(verses[vt][vn])+1
|
and verses[versetype].has_key(versenum):
|
||||||
our_verse_order.append([vt, vn, inst])
|
inst = len(verses[versetype][versenum])+1
|
||||||
|
our_verse_order.append([versetype, versenum, inst])
|
||||||
continue
|
continue
|
||||||
# number at start of line.. it's verse number
|
# number at start of line.. it's verse number
|
||||||
if thisline[0].isdigit():
|
if thisline[0].isdigit():
|
||||||
vn = thisline[0]
|
versenum = thisline[0]
|
||||||
thisline = thisline[1:].strip()
|
thisline = thisline[1:].strip()
|
||||||
our_verse_order.append([vt, vn, inst])
|
our_verse_order.append([versetype, versenum, inst])
|
||||||
if not verses.has_key(vt):
|
if not verses.has_key(versetype):
|
||||||
verses[vt] = {}
|
verses[versetype] = {}
|
||||||
if not verses[vt].has_key(vn):
|
if not verses[versetype].has_key(versenum):
|
||||||
verses[vt][vn] = {}
|
verses[versetype][versenum] = {}
|
||||||
if not verses[vt][vn].has_key(inst):
|
if not verses[versetype][versenum].has_key(inst):
|
||||||
verses[vt][vn][inst] = []
|
verses[versetype][versenum][inst] = []
|
||||||
# Tidy text and remove the ____s from extended words
|
# Tidy text and remove the ____s from extended words
|
||||||
thisline = self.tidy_text(thisline)
|
thisline = self.tidy_text(thisline)
|
||||||
thisline = thisline.replace(u'_', u'')
|
thisline = thisline.replace(u'_', u'')
|
||||||
thisline = thisline.replace(u'|', u'\n')
|
thisline = thisline.replace(u'|', u'\n')
|
||||||
verses[vt][vn][inst].append(thisline)
|
verses[versetype][versenum][inst].append(thisline)
|
||||||
# done parsing
|
# done parsing
|
||||||
# add verses in original order
|
# add verses in original order
|
||||||
for (vt, vn, inst) in our_verse_order:
|
for (versetype, versenum, inst) in our_verse_order:
|
||||||
vtag = u'%s%s' % (vt, vn)
|
vtag = u'%s%s' % (versetype, versenum)
|
||||||
lines = u'\n'.join(verses[vt][vn][inst])
|
lines = u'\n'.join(verses[versetype][versenum][inst])
|
||||||
self.add_verse(lines, vtag)
|
self.add_verse(lines, vtag)
|
||||||
# figure out the presentation order, if present
|
# figure out the presentation order, if present
|
||||||
if u'presentation' in fields and root.presentation != u'':
|
if u'presentation' in fields and root.presentation != u'':
|
||||||
@ -281,16 +282,17 @@ class OpenSongImport(SongImport):
|
|||||||
for tag in order:
|
for tag in order:
|
||||||
match = re.match(u'(.*)(\d+.*)', tag)
|
match = re.match(u'(.*)(\d+.*)', tag)
|
||||||
if match is not None:
|
if match is not None:
|
||||||
vt = match.group(1)
|
versetype = match.group(1)
|
||||||
vn = match.group(2)
|
versenum = match.group(2)
|
||||||
if not len(vt):
|
if not len(versetype):
|
||||||
vt = u'V'
|
versetype = u'V'
|
||||||
else:
|
else:
|
||||||
# Assume it's no.1 if there are no digits
|
# Assume it's no.1 if there are no digits
|
||||||
vt = tag
|
versetype = tag
|
||||||
vn = u'1'
|
versenum = u'1'
|
||||||
vtagString = u'%s%s' % (vt, vn)
|
vtagString = u'%s%s' % (versetype, versenum)
|
||||||
if verses.has_key(vt) and verses[vt].has_key(vn):
|
if verses.has_key(versetype) \
|
||||||
|
and verses[versetype].has_key(versenum):
|
||||||
self.verse_order_list.append(vtagString)
|
self.verse_order_list.append(vtagString)
|
||||||
else:
|
else:
|
||||||
log.info(u'Got order %s but not in versetags, dropping'
|
log.info(u'Got order %s but not in versetags, dropping'
|
||||||
|
Loading…
Reference in New Issue
Block a user