Clean up song imports

This commit is contained in:
Tim Bentley 2010-06-06 08:28:07 +01:00
parent e06556489e
commit 4714502f67
2 changed files with 51 additions and 49 deletions

View File

@ -106,7 +106,8 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
self.VerseTypeComboBox.setCurrentIndex(VerseType.from_string(verse_type))
self.VerseNumberBox.setValue(verse_number)
def setVerse(self, text, single=False, tag=u'%s:1' % VerseType.to_string(VerseType.Verse)):
def setVerse(self, text, single=False,
tag=u'%s:1' % VerseType.to_string(VerseType.Verse)):
if single:
verse_type, verse_number = tag.split(u':')
self.VerseTypeComboBox.setCurrentIndex(VerseType.from_string(verse_type))

View File

@ -29,6 +29,7 @@ from PyQt4 import QtGui
from openlp.core.lib import SongXMLBuilder
from openlp.plugins.songs.lib.models import Song, Author, Topic, Book
from openlp.plugins.songs.forms import VerseType
class SongImport(object):
"""
@ -293,19 +294,19 @@ class SongImport(object):
sxml.add_lyrics_to_song()
for (versetag, versetext) in self.verses:
if versetag[0] == u'C':
versetype = u'Chorus'
versetype = VerseType.to_string(VerseType.Chorus)
elif versetag[0] == u'V':
versetype = u'Verse'
versetype = VerseType.to_string(VerseType.Verse)
elif versetag[0] == u'B':
versetype = u'Bridge'
versetype = VerseType.to_string(VerseType.Bridge)
elif versetag[0] == u'I':
versetype = u'Intro'
versetype = VerseType.to_string(VerseType.Intro)
elif versetag[0] == u'P':
versetype = u'Prechorus'
versetype = VerseType.to_string(VerseType.PreChorus)
elif versetag[0] == u'E':
versetype = u'Ending'
versetype = VerseType.to_string(VerseType.Ending)
else:
versetype = u'Other'
versetype = VerseType.to_string(VerseType.Other)
sxml.add_verse_to_lyrics(versetype, versetag[1:], versetext)
song.search_lyrics += u' ' + self.remove_punctuation(versetext)
song.lyrics = unicode(sxml.extract_xml(), u'utf-8')