more changes reflecting VerseType changes

This commit is contained in:
Mattias Põldaru 2011-02-16 21:09:06 +02:00
parent 89181e387d
commit 425ec8ece0
2 changed files with 8 additions and 17 deletions

View File

@ -210,7 +210,7 @@ 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
versetype = u'V' versetype = u'v'
versenum = 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
@ -285,7 +285,7 @@ class OpenSongImport(SongImport):
versetype = match.group(1) versetype = match.group(1)
versenum = match.group(2) versenum = match.group(2)
if not len(versetype): if not len(versetype):
versetype = 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
versetype = tag versetype = tag

View File

@ -200,7 +200,7 @@ class SongImport(QtCore.QObject):
return return
self.media_files.append(filename) self.media_files.append(filename)
def add_verse(self, versetext, versetag=u'V', lang=None): def add_verse(self, versetext, versetag=u'v', lang=None):
""" """
Add a verse. This is the whole verse, lines split by \\n. It will also Add a verse. This is the whole verse, lines split by \\n. It will also
attempt to detect duplicates. In this case it will just add to the verse attempt to detect duplicates. In this case it will just add to the verse
@ -278,23 +278,14 @@ class SongImport(QtCore.QObject):
sxml = SongXML() sxml = SongXML()
other_count = 1 other_count = 1
for (versetag, versetext, lang) in self.verses: for (versetag, versetext, lang) in self.verses:
if versetag[0] == u'C': if versetag[0].lower() in VerseType.Tags:
versetype = VerseType.to_string(VerseType.Chorus) versetype = versetag[0].lower()
elif versetag[0] == u'V':
versetype = VerseType.to_string(VerseType.Verse)
elif versetag[0] == u'B':
versetype = VerseType.to_string(VerseType.Bridge)
elif versetag[0] == u'I':
versetype = VerseType.to_string(VerseType.Intro)
elif versetag[0] == u'P':
versetype = VerseType.to_string(VerseType.PreChorus)
elif versetag[0] == u'E':
versetype = VerseType.to_string(VerseType.Ending)
else: else:
newversetag = u'O%d' % other_count newversetag = u'%s%d' % (VerseType.Tags[VerseType.Other],
other_count)
verses_changed_to_other[versetag] = newversetag verses_changed_to_other[versetag] = newversetag
other_count += 1 other_count += 1
versetype = VerseType.to_string(VerseType.Other) versetype = VerseType.Tags[VerseType.Other]
log.info(u'Versetype %s changing to %s' , versetag, newversetag) log.info(u'Versetype %s changing to %s' , versetag, newversetag)
versetag = newversetag versetag = newversetag
sxml.add_verse_to_lyrics(versetype, versetag[1:], versetext, lang) sxml.add_verse_to_lyrics(versetype, versetag[1:], versetext, lang)