forked from openlp/openlp
changed skip_song to save_song & changed logic arround
bzr-revno: 2151 Fixes: https://launchpad.net/bugs/1174039
This commit is contained in:
commit
3ec0337649
@ -96,6 +96,7 @@ import os
|
||||
|
||||
from lxml import etree, objectify
|
||||
|
||||
from openlp.core.lib import translate
|
||||
from openlp.core.ui.wizard import WizardStrings
|
||||
from openlp.plugins.songs.lib import clean_song, VerseType
|
||||
from openlp.plugins.songs.lib.songimport import SongImport
|
||||
@ -115,7 +116,7 @@ class FoilPresenterImport(SongImport):
|
||||
"""
|
||||
log.debug(u'initialise FoilPresenterImport')
|
||||
SongImport.__init__(self, manager, **kwargs)
|
||||
self.FoilPresenter = FoilPresenter(self.manager)
|
||||
self.FoilPresenter = FoilPresenter(self.manager, self)
|
||||
|
||||
def doImport(self):
|
||||
"""
|
||||
@ -202,8 +203,9 @@ class FoilPresenter(object):
|
||||
<copyright> tag.
|
||||
|
||||
"""
|
||||
def __init__(self, manager):
|
||||
def __init__(self, manager, importer):
|
||||
self.manager = manager
|
||||
self.importer = importer
|
||||
|
||||
def xml_to_song(self, xml):
|
||||
"""
|
||||
@ -222,6 +224,7 @@ class FoilPresenter(object):
|
||||
song.search_lyrics = u''
|
||||
song.verse_order = u''
|
||||
song.search_title = u''
|
||||
self.save_song = True
|
||||
# Because "text" seems to be an reserverd word, we have to recompile it.
|
||||
xml = re.compile(u'<text>').sub(u'<text_>', xml)
|
||||
xml = re.compile(u'</text>').sub(u'</text_>', xml)
|
||||
@ -236,8 +239,9 @@ class FoilPresenter(object):
|
||||
self._process_authors(foilpresenterfolie, song)
|
||||
self._process_songbooks(foilpresenterfolie, song)
|
||||
self._process_topics(foilpresenterfolie, song)
|
||||
clean_song(self.manager, song)
|
||||
self.manager.save_object(song)
|
||||
if self.save_song:
|
||||
clean_song(self.manager, song)
|
||||
self.manager.save_object(song)
|
||||
|
||||
def _child(self, element):
|
||||
"""
|
||||
@ -424,6 +428,12 @@ class FoilPresenter(object):
|
||||
VerseType.Tags[VerseType.Intro]: 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.save_song = False
|
||||
return
|
||||
for strophe in foilpresenterfolie.strophen.strophe:
|
||||
text = self._child(strophe.text_) if hasattr(strophe, u'text_') \
|
||||
else u''
|
||||
|
Loading…
Reference in New Issue
Block a user