Fix for importing old bible DBs, like KJV

This commit is contained in:
Tomas Groth 2014-11-07 13:06:58 +01:00
parent 519119aecb
commit a8bd5f1996
2 changed files with 9 additions and 2 deletions

View File

@ -159,7 +159,7 @@ class BiblePlugin(Plugin):
self.upgrade_wizard = BibleUpgradeForm(self.main_window, self.manager, self)
# If the import was not cancelled then reload.
if self.upgrade_wizard.exec_():
self.media_item.reloadBibles()
self.media_item.reload_bibles()
def on_bible_import_click(self):
if self.media_item:

View File

@ -170,6 +170,9 @@ class BibleDB(QtCore.QObject, Manager, RegistryProperties):
Returns the version name of the Bible.
"""
version_name = self.get_object(BibleMeta, 'name')
# Fallback to old way of naming
if not version_name:
version_name = self.get_object(BibleMeta, 'Version')
self.name = version_name.value if version_name else None
return self.name
@ -969,11 +972,15 @@ class OldBibleDB(QtCore.QObject, Manager):
"""
Returns the version name of the Bible.
"""
self.name = None
version_name = self.run_sql('SELECT value FROM metadata WHERE key = "name"')
if version_name:
self.name = version_name[0][0]
else:
self.name = None
# Fallback to old way of naming
version_name = self.run_sql('SELECT value FROM metadata WHERE key = "Version"')
if version_name:
self.name = version_name[0][0]
return self.name
def get_metadata(self):