forked from openlp/openlp
Convert verse tags
This commit is contained in:
parent
e2ac8b6dcc
commit
6ecc121bdf
@ -478,8 +478,8 @@ class MediaManagerItem(QtGui.QWidget):
|
||||
translate('OpenLP.MediaManagerItem',
|
||||
'You must select one or more items.'))
|
||||
else:
|
||||
# Is it posssible to process multiple list items to generate multiple
|
||||
# service items?
|
||||
# Is it posssible to process multiple list items to generate
|
||||
# multiple service items?
|
||||
if self.singleServiceItem or self.remoteTriggered:
|
||||
log.debug(self.plugin.name + u' Add requested')
|
||||
serviceItem = self.buildServiceItem(None, True)
|
||||
|
@ -62,6 +62,36 @@ class VerseType(object):
|
||||
elif verse_type == VerseType.Other:
|
||||
return translate('SongsPlugin.VerseType', 'Other')
|
||||
|
||||
@staticmethod
|
||||
def expand_string(verse_type):
|
||||
"""
|
||||
Return the VerseType for a given string
|
||||
|
||||
``verse_type``
|
||||
The string to return a VerseType for
|
||||
"""
|
||||
verse_type = verse_type.lower()
|
||||
if verse_type == unicode(VerseType.to_string(VerseType.Verse)).lower()[0]:
|
||||
return translate('SongsPlugin.VerseType', 'Verse')
|
||||
elif verse_type == \
|
||||
unicode(VerseType.to_string(VerseType.Chorus)).lower()[0]:
|
||||
return translate('SongsPlugin.VerseType', 'Chorus')
|
||||
elif verse_type == \
|
||||
unicode(VerseType.to_string(VerseType.Bridge)).lower()[0]:
|
||||
return translate('SongsPlugin.VerseType', 'Bridge')
|
||||
elif verse_type == \
|
||||
unicode(VerseType.to_string(VerseType.PreChorus)).lower()[0]:
|
||||
return translate('SongsPlugin.VerseType', 'PreChorus')
|
||||
elif verse_type == \
|
||||
unicode(VerseType.to_string(VerseType.Intro)).lower()[0]:
|
||||
return translate('SongsPlugin.VerseType', 'Intro')
|
||||
elif verse_type == \
|
||||
unicode(VerseType.to_string(VerseType.Ending)).lower()[0]:
|
||||
return translate('SongsPlugin.VerseType', 'Ending')
|
||||
elif verse_type == \
|
||||
unicode(VerseType.to_string(VerseType.Other)).lower()[0]:
|
||||
return translate('SongsPlugin.VerseType', 'Other')
|
||||
|
||||
@staticmethod
|
||||
def from_string(verse_type):
|
||||
"""
|
||||
|
@ -397,6 +397,7 @@ class SongMediaItem(MediaManagerItem):
|
||||
]
|
||||
service_item.data_string = {u'title':song.search_title,
|
||||
u'authors':author_list}
|
||||
# if xmlVersion:
|
||||
service_item.xml_version = self.openLyrics.song_to_xml(song)
|
||||
return True
|
||||
|
||||
|
@ -42,6 +42,7 @@ import logging
|
||||
import re
|
||||
|
||||
from lxml import etree, objectify
|
||||
from openlp.plugins.songs.lib import VerseType
|
||||
from openlp.plugins.songs.lib.db import Author, Song
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
@ -330,7 +331,8 @@ class OpenLyricsParser(object):
|
||||
text = line
|
||||
else:
|
||||
text += u'\n' + line
|
||||
sxml.add_verse_to_lyrics(u'V', verse.attrib[u'name'], text)
|
||||
type = VerseType.expand_string(verse.attrib[u'name'][0])
|
||||
sxml.add_verse_to_lyrics(type, verse.attrib[u'name'][1], text)
|
||||
search_text = search_text + text
|
||||
song.search_lyrics = search_text.lower()
|
||||
song.lyrics = unicode(sxml.extract_xml(), u'utf-8')
|
||||
|
Loading…
Reference in New Issue
Block a user