From 72120d8b2fd29167cc156598df6277ae26769ca9 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Tue, 24 May 2016 13:49:08 +0200 Subject: [PATCH] Skip PresentationManager files we do not support. --- openlp/plugins/songs/lib/importers/presentationmanager.py | 8 +++++++- openlp/plugins/songs/lib/importers/videopsalm.py | 3 +-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/openlp/plugins/songs/lib/importers/presentationmanager.py b/openlp/plugins/songs/lib/importers/presentationmanager.py index c26f11312..5d8db4d26 100644 --- a/openlp/plugins/songs/lib/importers/presentationmanager.py +++ b/openlp/plugins/songs/lib/importers/presentationmanager.py @@ -55,7 +55,13 @@ class PresentationManagerImport(SongImport): # Open file with detected encoding and remove encoding declaration text = open(file_path, mode='r', encoding=encoding).read() 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)) self.process_song(root) diff --git a/openlp/plugins/songs/lib/importers/videopsalm.py b/openlp/plugins/songs/lib/importers/videopsalm.py index 6723fb4c1..edf5e89a8 100644 --- a/openlp/plugins/songs/lib/importers/videopsalm.py +++ b/openlp/plugins/songs/lib/importers/videopsalm.py @@ -117,6 +117,5 @@ class VideoPsalmImport(SongImport): if not self.finish(): self.log_error('Could not import %s' % self.title) except Exception as e: - self.log_error(translate('SongsPlugin.VideoPsalmImport', 'File %s') % song_file.name, - translate('SongsPlugin.VideoPsalmImport', 'Error: %s') % e) + self.log_error(song_file.name, translate('SongsPlugin.VideoPsalmImport', 'Error: %s') % e) song_file.close()