remove corrupted bibles

This commit is contained in:
Andreas Preikschat 2011-03-13 16:58:27 +01:00
parent f5bc71f777
commit 9c30635fcb
1 changed files with 6 additions and 2 deletions

View File

@ -25,14 +25,14 @@
############################################################################### ###############################################################################
import logging import logging
import os
from PyQt4 import QtCore from PyQt4 import QtCore
from openlp.core.lib import Receiver, SettingsManager, translate 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 import parse_reference
from openlp.plugins.bibles.lib.db import BibleDB, BibleMeta from openlp.plugins.bibles.lib.db import BibleDB, BibleMeta
from csvbible import CSVBible from csvbible import CSVBible
from http import HTTPBible from http import HTTPBible
from opensong import OpenSongBible from opensong import OpenSongBible
@ -144,6 +144,10 @@ class BibleManager(object):
for filename in files: for filename in files:
bible = BibleDB(self.parent, path=self.path, file=filename) bible = BibleDB(self.parent, path=self.path, file=filename)
name = bible.get_name() 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) log.debug(u'Bible Name: "%s"', name)
self.db_cache[name] = bible self.db_cache[name] = bible
# Look to see if lazy load bible exists and get create getter. # Look to see if lazy load bible exists and get create getter.