forked from openlp/openlp
Fixes bug #946581 'Prevent users from importing the wrong files'
bzr-revno: 1922
This commit is contained in:
commit
75212def12
@ -554,7 +554,9 @@ class SongImportForm(OpenLPWizard):
|
|||||||
Get CCLI song database files
|
Get CCLI song database files
|
||||||
"""
|
"""
|
||||||
self.getFiles(WizardStrings.OpenTypeFile % WizardStrings.CCLI,
|
self.getFiles(WizardStrings.OpenTypeFile % WizardStrings.CCLI,
|
||||||
self.ccliFileListWidget)
|
self.ccliFileListWidget, u'%s (*.usr *.txt)'
|
||||||
|
% translate('SongsPlugin.ImportWizardForm',
|
||||||
|
'CCLI SongSelect Files'))
|
||||||
|
|
||||||
def onCCLIRemoveButtonClicked(self):
|
def onCCLIRemoveButtonClicked(self):
|
||||||
"""
|
"""
|
||||||
@ -595,15 +597,22 @@ class SongImportForm(OpenLPWizard):
|
|||||||
self.removeSelectedItems(self.genericFileListWidget)
|
self.removeSelectedItems(self.genericFileListWidget)
|
||||||
|
|
||||||
def onEasySlidesBrowseButtonClicked(self):
|
def onEasySlidesBrowseButtonClicked(self):
|
||||||
|
"""
|
||||||
|
Get EasySlides song database file
|
||||||
|
"""
|
||||||
self.getFileName(WizardStrings.OpenTypeFile % WizardStrings.ES,
|
self.getFileName(WizardStrings.OpenTypeFile % WizardStrings.ES,
|
||||||
self.easySlidesFilenameEdit)
|
self.easySlidesFilenameEdit, u'%s (*.xml)'
|
||||||
|
% translate('SongsPlugin.ImportWizardForm',
|
||||||
|
'EasySlides XML File'))
|
||||||
|
|
||||||
def onEWBrowseButtonClicked(self):
|
def onEWBrowseButtonClicked(self):
|
||||||
"""
|
"""
|
||||||
Get EasyWorship song database files
|
Get EasyWorship song database files
|
||||||
"""
|
"""
|
||||||
self.getFileName(WizardStrings.OpenTypeFile % WizardStrings.EW,
|
self.getFileName(WizardStrings.OpenTypeFile % WizardStrings.EW,
|
||||||
self.ewFilenameEdit)
|
self.ewFilenameEdit, u'%s (*.db)'
|
||||||
|
% translate('SongsPlugin.ImportWizardForm',
|
||||||
|
'EasyWorship Song Database'))
|
||||||
|
|
||||||
def onSongBeamerAddButtonClicked(self):
|
def onSongBeamerAddButtonClicked(self):
|
||||||
"""
|
"""
|
||||||
|
@ -31,6 +31,7 @@ import re
|
|||||||
from lxml import objectify
|
from lxml import objectify
|
||||||
from lxml.etree import Error, LxmlError
|
from lxml.etree import Error, LxmlError
|
||||||
|
|
||||||
|
from openlp.core.lib import translate
|
||||||
from openlp.plugins.songs.lib import VerseType
|
from openlp.plugins.songs.lib import VerseType
|
||||||
from openlp.plugins.songs.lib.songimport import SongImport
|
from openlp.plugins.songs.lib.songimport import SongImport
|
||||||
from openlp.plugins.songs.lib.ui import SongStrings
|
from openlp.plugins.songs.lib.ui import SongStrings
|
||||||
@ -128,6 +129,12 @@ class OpenSongImport(SongImport):
|
|||||||
log.exception(u'Error parsing XML')
|
log.exception(u'Error parsing XML')
|
||||||
return
|
return
|
||||||
root = tree.getroot()
|
root = tree.getroot()
|
||||||
|
if root.tag != u'song':
|
||||||
|
self.logError(file.name, unicode(
|
||||||
|
translate('SongsPlugin.OpenSongImport',
|
||||||
|
('Invalid OpenSong song file. Missing '
|
||||||
|
'song tag.'))))
|
||||||
|
return
|
||||||
fields = dir(root)
|
fields = dir(root)
|
||||||
decode = {
|
decode = {
|
||||||
u'copyright': self.addCopyright,
|
u'copyright': self.addCopyright,
|
||||||
|
Loading…
Reference in New Issue
Block a user