forked from openlp/openlp
Fixes bug #946581 "Prevent users from importing the wrong files"
Checks for the song tag in OpenSong (as Gushie said it has no extensions) Addes file extension filters for CCLI, EasyWorship & EasySlides Fixes: https://launchpad.net/bugs/946581
This commit is contained in:
parent
6f361ad018
commit
a08a244084
@ -554,7 +554,9 @@ class SongImportForm(OpenLPWizard):
|
||||
Get CCLI song database files
|
||||
"""
|
||||
self.getFiles(WizardStrings.OpenTypeFile % WizardStrings.CCLI,
|
||||
self.ccliFileListWidget)
|
||||
self.ccliFileListWidget, u'%s (*.usr *.txt)'
|
||||
% translate('SongsPlugin.ImportWizardForm',
|
||||
'CCLI SongSelect Files'))
|
||||
|
||||
def onCCLIRemoveButtonClicked(self):
|
||||
"""
|
||||
@ -595,15 +597,22 @@ class SongImportForm(OpenLPWizard):
|
||||
self.removeSelectedItems(self.genericFileListWidget)
|
||||
|
||||
def onEasySlidesBrowseButtonClicked(self):
|
||||
"""
|
||||
Get EasyWorship song database file
|
||||
"""
|
||||
self.getFileName(WizardStrings.OpenTypeFile % WizardStrings.ES,
|
||||
self.easySlidesFilenameEdit)
|
||||
self.easySlidesFilenameEdit, u'%s (*.xml)'
|
||||
% translate('SongsPlugin.ImportWizardForm',
|
||||
'EasySlides XML File'))
|
||||
|
||||
def onEWBrowseButtonClicked(self):
|
||||
"""
|
||||
Get EasyWorship song database files
|
||||
"""
|
||||
self.getFileName(WizardStrings.OpenTypeFile % WizardStrings.EW,
|
||||
self.ewFilenameEdit)
|
||||
self.ewFilenameEdit, u'%s (*.db)'
|
||||
% translate('SongsPlugin.ImportWizardForm',
|
||||
'EasyWorship Song Database'))
|
||||
|
||||
def onSongBeamerAddButtonClicked(self):
|
||||
"""
|
||||
|
@ -31,6 +31,7 @@ import re
|
||||
from lxml import objectify
|
||||
from lxml.etree import Error, LxmlError
|
||||
|
||||
from openlp.core.lib import translate
|
||||
from openlp.plugins.songs.lib import VerseType
|
||||
from openlp.plugins.songs.lib.songimport import SongImport
|
||||
from openlp.plugins.songs.lib.ui import SongStrings
|
||||
@ -128,6 +129,12 @@ class OpenSongImport(SongImport):
|
||||
log.exception(u'Error parsing XML')
|
||||
return
|
||||
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)
|
||||
decode = {
|
||||
u'copyright': self.addCopyright,
|
||||
|
Loading…
Reference in New Issue
Block a user