forked from openlp/openlp
r2074
This commit is contained in:
commit
be3cb74ad7
@ -160,10 +160,12 @@ class BGExtract(object):
|
||||
verse = verse.strip()
|
||||
try:
|
||||
verse = int(verse)
|
||||
except (TypeError, ValueError):
|
||||
except ValueError:
|
||||
verse_parts = verse.split(u'-')
|
||||
if len(verse_parts) > 1:
|
||||
verse = int(verse_parts[0])
|
||||
except TypeError:
|
||||
log.warn(u'Illegal verse number: %s', unicode(raw_verse_num))
|
||||
verses.append((verse, text))
|
||||
verse_list = {}
|
||||
for verse, text in verses[::-1]:
|
||||
@ -194,6 +196,10 @@ class BGExtract(object):
|
||||
try:
|
||||
clean_verse_num = int(str(raw_verse_num))
|
||||
except ValueError:
|
||||
verse_parts = str(raw_verse_num).split(u'-')
|
||||
if len(verse_parts) > 1:
|
||||
clean_verse_num = int(verse_parts[0])
|
||||
except TypeError:
|
||||
log.warn(u'Illegal verse number: %s', unicode(raw_verse_num))
|
||||
if clean_verse_num:
|
||||
verse_text = raw_verse_num.next
|
||||
|
@ -366,15 +366,20 @@ class BibleManager(object):
|
||||
"""
|
||||
log.debug(u'BibleManager.get_language_selection("%s")', bible)
|
||||
language_selection = self.get_meta_data(bible, u'book_name_language')
|
||||
if language_selection:
|
||||
try:
|
||||
language_selection = int(language_selection.value)
|
||||
except (ValueError, TypeError):
|
||||
language_selection = LanguageSelection.Application
|
||||
if language_selection is None or language_selection == -1:
|
||||
if not language_selection or \
|
||||
language_selection.value == "None" or \
|
||||
language_selection.value == "-1":
|
||||
# If None is returned, it's not the singleton object but a
|
||||
# BibleMeta object with the value "None"
|
||||
language_selection = Settings().value(
|
||||
self.settingsSection + u'/bookname language',
|
||||
self.settingsSection + u'/book name language',
|
||||
QtCore.QVariant(0)).toInt()[0]
|
||||
else:
|
||||
language_selection = language_selection.value
|
||||
try:
|
||||
language_selection = int(language_selection)
|
||||
except (ValueError, TypeError):
|
||||
language_selection = LanguageSelection.Application
|
||||
return language_selection
|
||||
|
||||
def verse_search(self, bible, second_bible, text):
|
||||
|
@ -103,10 +103,20 @@ class OpenSongBible(BibleDB):
|
||||
for verse in chapter.v:
|
||||
if self.stop_import_flag:
|
||||
break
|
||||
verse_number = 0
|
||||
try:
|
||||
verse_number = int(verse.attrib[u'n'])
|
||||
except ValueError:
|
||||
verse_parts = verse.attrib[u'n'].split(u'-')
|
||||
if len(verse_parts) > 1:
|
||||
verse_number = int(verse_parts[0])
|
||||
except TypeError:
|
||||
log.warn(u'Illegal verse number: %s',
|
||||
unicode(verse.attrib[u'n']))
|
||||
self.create_verse(
|
||||
db_book.id,
|
||||
int(chapter.attrib[u'n'].split()[-1]),
|
||||
int(verse.attrib[u'n']),
|
||||
verse_number,
|
||||
unicode(self.get_text(verse)))
|
||||
self.wizard.incrementProgressBar(unicode(translate(
|
||||
'BiblesPlugin.Opensong', 'Importing %s %s...',
|
||||
|
Loading…
Reference in New Issue
Block a user