forked from openlp/openlp
parent
51905bcb59
commit
ad3d1b5e94
@ -96,6 +96,7 @@ import os
|
|||||||
|
|
||||||
from lxml import etree, objectify
|
from lxml import etree, objectify
|
||||||
|
|
||||||
|
from openlp.core.lib import translate
|
||||||
from openlp.core.ui.wizard import WizardStrings
|
from openlp.core.ui.wizard import WizardStrings
|
||||||
from openlp.plugins.songs.lib import clean_song, VerseType
|
from openlp.plugins.songs.lib import clean_song, VerseType
|
||||||
from openlp.plugins.songs.lib.songimport import SongImport
|
from openlp.plugins.songs.lib.songimport import SongImport
|
||||||
@ -115,7 +116,7 @@ class FoilPresenterImport(SongImport):
|
|||||||
"""
|
"""
|
||||||
log.debug(u'initialise FoilPresenterImport')
|
log.debug(u'initialise FoilPresenterImport')
|
||||||
SongImport.__init__(self, manager, **kwargs)
|
SongImport.__init__(self, manager, **kwargs)
|
||||||
self.FoilPresenter = FoilPresenter(self.manager)
|
self.FoilPresenter = FoilPresenter(self.manager, self)
|
||||||
|
|
||||||
def doImport(self):
|
def doImport(self):
|
||||||
"""
|
"""
|
||||||
@ -202,8 +203,9 @@ class FoilPresenter(object):
|
|||||||
<copyright> tag.
|
<copyright> tag.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
def __init__(self, manager):
|
def __init__(self, manager, importer):
|
||||||
self.manager = manager
|
self.manager = manager
|
||||||
|
self.importer = importer
|
||||||
|
|
||||||
def xml_to_song(self, xml):
|
def xml_to_song(self, xml):
|
||||||
"""
|
"""
|
||||||
@ -222,20 +224,21 @@ class FoilPresenter(object):
|
|||||||
song.search_lyrics = u''
|
song.search_lyrics = u''
|
||||||
song.verse_order = u''
|
song.verse_order = u''
|
||||||
song.search_title = u''
|
song.search_title = u''
|
||||||
# Because "text" seems to be an reserverd word, we have to recompile it.
|
self.skip_song = False
|
||||||
|
# Because "text" seems to be an reserved word, we have to recompile it.
|
||||||
xml = re.compile(u'<text>').sub(u'<text_>', xml)
|
xml = re.compile(u'<text>').sub(u'<text_>', xml)
|
||||||
xml = re.compile(u'</text>').sub(u'</text_>', xml)
|
xml = re.compile(u'</text>').sub(u'</text_>', xml)
|
||||||
song_xml = objectify.fromstring(xml)
|
song_xml = objectify.fromstring(xml)
|
||||||
foilpresenterfolie = song_xml
|
self._process_copyright(song_xml, song)
|
||||||
self._process_copyright(foilpresenterfolie, song)
|
self._process_cclinumber(song_xml, song)
|
||||||
self._process_cclinumber(foilpresenterfolie, song)
|
self._process_titles(song_xml, song)
|
||||||
self._process_titles(foilpresenterfolie, song)
|
|
||||||
# The verse order is processed with the lyrics!
|
# The verse order is processed with the lyrics!
|
||||||
self._process_lyrics(foilpresenterfolie, song)
|
self._process_lyrics(song_xml, song)
|
||||||
self._process_comments(foilpresenterfolie, song)
|
self._process_comments(song_xml, song)
|
||||||
self._process_authors(foilpresenterfolie, song)
|
self._process_authors(song_xml, song)
|
||||||
self._process_songbooks(foilpresenterfolie, song)
|
self._process_songbooks(song_xml, song)
|
||||||
self._process_topics(foilpresenterfolie, song)
|
self._process_topics(song_xml, song)
|
||||||
|
if not self.skip_song:
|
||||||
clean_song(self.manager, song)
|
clean_song(self.manager, song)
|
||||||
self.manager.save_object(song)
|
self.manager.save_object(song)
|
||||||
|
|
||||||
@ -420,6 +423,12 @@ class FoilPresenter(object):
|
|||||||
VerseType.tags[VerseType.Intro]: 1,
|
VerseType.tags[VerseType.Intro]: 1,
|
||||||
VerseType.tags[VerseType.PreChorus]: 1
|
VerseType.tags[VerseType.PreChorus]: 1
|
||||||
}
|
}
|
||||||
|
if not hasattr(foilpresenterfolie.strophen, u'strophe'):
|
||||||
|
self.importer.logError(self._child(foilpresenterfolie.titel),
|
||||||
|
unicode(translate('SongsPlugin.FoilPresenterSongImport',
|
||||||
|
'Invalid Foilpresenter song file. No verses found.')))
|
||||||
|
self.skip_song = True
|
||||||
|
return
|
||||||
for strophe in foilpresenterfolie.strophen.strophe:
|
for strophe in foilpresenterfolie.strophen.strophe:
|
||||||
text = self._child(strophe.text_) if hasattr(strophe, u'text_') else u''
|
text = self._child(strophe.text_) if hasattr(strophe, u'text_') else u''
|
||||||
verse_name = self._child(strophe.key)
|
verse_name = self._child(strophe.key)
|
||||||
|
Loading…
Reference in New Issue
Block a user