forked from openlp/openlp
Skip PresentationManager files we do not support.
This commit is contained in:
parent
90f927ae7f
commit
72120d8b2f
@ -55,7 +55,13 @@ class PresentationManagerImport(SongImport):
|
|||||||
# Open file with detected encoding and remove encoding declaration
|
# Open file with detected encoding and remove encoding declaration
|
||||||
text = open(file_path, mode='r', encoding=encoding).read()
|
text = open(file_path, mode='r', encoding=encoding).read()
|
||||||
text = re.sub('.+\?>\n', '', text)
|
text = re.sub('.+\?>\n', '', text)
|
||||||
tree = etree.fromstring(text, parser=etree.XMLParser(recover=True))
|
try:
|
||||||
|
tree = etree.fromstring(text, parser=etree.XMLParser(recover=True))
|
||||||
|
except ValueError:
|
||||||
|
self.log_error(file_path,
|
||||||
|
translate('SongsPlugin.PresentationManagerImport',
|
||||||
|
'File is not in XML-format, which is the only format supported.'))
|
||||||
|
continue
|
||||||
root = objectify.fromstring(etree.tostring(tree))
|
root = objectify.fromstring(etree.tostring(tree))
|
||||||
self.process_song(root)
|
self.process_song(root)
|
||||||
|
|
||||||
|
@ -117,6 +117,5 @@ class VideoPsalmImport(SongImport):
|
|||||||
if not self.finish():
|
if not self.finish():
|
||||||
self.log_error('Could not import %s' % self.title)
|
self.log_error('Could not import %s' % self.title)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.log_error(translate('SongsPlugin.VideoPsalmImport', 'File %s') % song_file.name,
|
self.log_error(song_file.name, translate('SongsPlugin.VideoPsalmImport', 'Error: %s') % e)
|
||||||
translate('SongsPlugin.VideoPsalmImport', 'Error: %s') % e)
|
|
||||||
song_file.close()
|
song_file.close()
|
||||||
|
Loading…
Reference in New Issue
Block a user