From 9c30635fcb350e77e81b074341ad1104b3543c1b Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 13 Mar 2011 16:58:27 +0100 Subject: [PATCH] remove corrupted bibles --- openlp/plugins/bibles/lib/manager.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/openlp/plugins/bibles/lib/manager.py b/openlp/plugins/bibles/lib/manager.py index dcbad3e63..c11e10588 100644 --- a/openlp/plugins/bibles/lib/manager.py +++ b/openlp/plugins/bibles/lib/manager.py @@ -25,14 +25,14 @@ ############################################################################### import logging +import os from PyQt4 import QtCore from openlp.core.lib import Receiver, SettingsManager, translate -from openlp.core.utils import AppLocation +from openlp.core.utils import AppLocation, delete_file from openlp.plugins.bibles.lib import parse_reference from openlp.plugins.bibles.lib.db import BibleDB, BibleMeta - from csvbible import CSVBible from http import HTTPBible from opensong import OpenSongBible @@ -144,6 +144,10 @@ class BibleManager(object): for filename in files: bible = BibleDB(self.parent, path=self.path, file=filename) name = bible.get_name() + # Remove corrupted files. + if name is None: + delete_file(os.path.join(self.path, filename)) + continue log.debug(u'Bible Name: "%s"', name) self.db_cache[name] = bible # Look to see if lazy load bible exists and get create getter.