forked from openlp/openlp
Fix field names and verse order bug
This commit is contained in:
parent
cc9ef10821
commit
7f1e21c13b
@ -254,8 +254,8 @@ class OpenLyricsParser(object):
|
|||||||
"""
|
"""
|
||||||
Convert the song to OpenLyrics Format
|
Convert the song to OpenLyrics Format
|
||||||
"""
|
"""
|
||||||
songXML = SongXMLParser(song.lyrics)
|
song_xml_parser = SongXMLParser(song.lyrics)
|
||||||
verseList = songXML.get_verses()
|
verse_list = song_xml_parser.get_verses()
|
||||||
song_xml = objectify.fromstring(
|
song_xml = objectify.fromstring(
|
||||||
u'<song version="0.7" createdIn="OpenLP 2.0"/>')
|
u'<song version="0.7" createdIn="OpenLP 2.0"/>')
|
||||||
properties = etree.SubElement(song_xml, u'properties')
|
properties = etree.SubElement(song_xml, u'properties')
|
||||||
@ -274,10 +274,11 @@ class OpenLyricsParser(object):
|
|||||||
for author in song.authors:
|
for author in song.authors:
|
||||||
self._add_text_to_element(u'author', authors, author.display_name)
|
self._add_text_to_element(u'author', authors, author.display_name)
|
||||||
lyrics = etree.SubElement(song_xml, u'lyrics')
|
lyrics = etree.SubElement(song_xml, u'lyrics')
|
||||||
for verse in verseList:
|
for verse in verse_list:
|
||||||
verseTag = u'%s%s' % (
|
verse_tag = u'%s%s' % (
|
||||||
verse[0][u'type'][0].lower(), verse[0][u'label'])
|
verse[0][u'type'][0].lower(), verse[0][u'label'])
|
||||||
element = self._add_text_to_element(u'verse', lyrics, None, verseTag)
|
element = \
|
||||||
|
self._add_text_to_element(u'verse', lyrics, None, verse_tag)
|
||||||
element = self._add_text_to_element(u'lines', element)
|
element = self._add_text_to_element(u'lines', element)
|
||||||
for line in unicode(verse[1]).split(u'\n'):
|
for line in unicode(verse[1]).split(u'\n'):
|
||||||
self._add_text_to_element(u'line', element, line)
|
self._add_text_to_element(u'line', element, line)
|
||||||
@ -297,6 +298,8 @@ class OpenLyricsParser(object):
|
|||||||
properties = song_xml.properties
|
properties = song_xml.properties
|
||||||
song.copyright = unicode(properties.copyright.text)
|
song.copyright = unicode(properties.copyright.text)
|
||||||
song.verse_order = unicode(properties.verseOrder.text)
|
song.verse_order = unicode(properties.verseOrder.text)
|
||||||
|
if song.verse_order == u'None':
|
||||||
|
song.verse_order = u''
|
||||||
song.topics = []
|
song.topics = []
|
||||||
song.book = None
|
song.book = None
|
||||||
theme_name = None
|
theme_name = None
|
||||||
|
Loading…
Reference in New Issue
Block a user