forked from openlp/openlp
Fixed bug #993445 and cleaned up the logic a little in some other places.
bzr-revno: 2073
This commit is contained in:
commit
14efe006fc
@ -160,10 +160,12 @@ class BGExtract(object):
|
|||||||
verse = verse.strip()
|
verse = verse.strip()
|
||||||
try:
|
try:
|
||||||
verse = int(verse)
|
verse = int(verse)
|
||||||
except (TypeError, ValueError):
|
except ValueError:
|
||||||
verse_parts = verse.split(u'-')
|
verse_parts = verse.split(u'-')
|
||||||
if len(verse_parts) > 1:
|
if len(verse_parts) > 1:
|
||||||
verse = int(verse_parts[0])
|
verse = int(verse_parts[0])
|
||||||
|
except TypeError:
|
||||||
|
log.warn(u'Illegal verse number: %s', unicode(raw_verse_num))
|
||||||
verses.append((verse, text))
|
verses.append((verse, text))
|
||||||
verse_list = {}
|
verse_list = {}
|
||||||
for verse, text in verses[::-1]:
|
for verse, text in verses[::-1]:
|
||||||
@ -194,6 +196,10 @@ class BGExtract(object):
|
|||||||
try:
|
try:
|
||||||
clean_verse_num = int(str(raw_verse_num))
|
clean_verse_num = int(str(raw_verse_num))
|
||||||
except ValueError:
|
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))
|
log.warn(u'Illegal verse number: %s', unicode(raw_verse_num))
|
||||||
if clean_verse_num:
|
if clean_verse_num:
|
||||||
verse_text = raw_verse_num.next
|
verse_text = raw_verse_num.next
|
||||||
|
@ -103,10 +103,20 @@ class OpenSongBible(BibleDB):
|
|||||||
for verse in chapter.v:
|
for verse in chapter.v:
|
||||||
if self.stop_import_flag:
|
if self.stop_import_flag:
|
||||||
break
|
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(
|
self.create_verse(
|
||||||
db_book.id,
|
db_book.id,
|
||||||
int(chapter.attrib[u'n'].split()[-1]),
|
int(chapter.attrib[u'n'].split()[-1]),
|
||||||
int(verse.attrib[u'n']),
|
verse_number,
|
||||||
unicode(self.get_text(verse)))
|
unicode(self.get_text(verse)))
|
||||||
self.wizard.incrementProgressBar(unicode(translate(
|
self.wizard.incrementProgressBar(unicode(translate(
|
||||||
'BiblesPlugin.Opensong', 'Importing %s %s...',
|
'BiblesPlugin.Opensong', 'Importing %s %s...',
|
||||||
|
Loading…
Reference in New Issue
Block a user