forked from openlp/openlp
More BibleGateway work
This commit is contained in:
parent
60649e3624
commit
1c0ce26e54
@ -56,7 +56,8 @@ class BGExtract(BibleCommon):
|
|||||||
(bookname, unicode(chapter) , version)
|
(bookname, unicode(chapter) , version)
|
||||||
xml_string = self._get_web_text(urlstring, self.proxyurl)
|
xml_string = self._get_web_text(urlstring, self.proxyurl)
|
||||||
#print xml_string
|
#print xml_string
|
||||||
verseSearch = u'<sup class='
|
verseSearch = u'<sup class=\"versenum'
|
||||||
|
verseFootnote = u'<sup class=\'footnote'
|
||||||
verse = 1
|
verse = 1
|
||||||
i = xml_string.find(u'result-text-style-normal') + 26
|
i = xml_string.find(u'result-text-style-normal') + 26
|
||||||
xml_string = xml_string[i:len(xml_string)]
|
xml_string = xml_string[i:len(xml_string)]
|
||||||
@ -67,7 +68,6 @@ class BGExtract(BibleCommon):
|
|||||||
verseText = u''
|
verseText = u''
|
||||||
versePos = xml_string.find(u'</sup>', versePos) + 6
|
versePos = xml_string.find(u'</sup>', versePos) + 6
|
||||||
i = xml_string.find(verseSearch, versePos + 1)
|
i = xml_string.find(verseSearch, versePos + 1)
|
||||||
#print versePos, i, xml_string[versePos:i]#, xml_string
|
|
||||||
if i == -1:
|
if i == -1:
|
||||||
i = xml_string.find(u'</div', versePos + 1)
|
i = xml_string.find(u'</div', versePos + 1)
|
||||||
j = xml_string.find(u'<strong', versePos + 1)
|
j = xml_string.find(u'<strong', versePos + 1)
|
||||||
@ -78,6 +78,11 @@ class BGExtract(BibleCommon):
|
|||||||
versePos = -1
|
versePos = -1
|
||||||
else:
|
else:
|
||||||
verseText = xml_string[versePos: i]
|
verseText = xml_string[versePos: i]
|
||||||
|
start_tag = verseText.find(verseFootnote)
|
||||||
|
while start_tag > -1:
|
||||||
|
end_tag = verseText.find(u'</sup>')
|
||||||
|
verseText = verseText[:start_tag] + verseText[end_tag + 6:len(verseText)]
|
||||||
|
start_tag = verseText.find(verseFootnote)
|
||||||
# Chop off verse and start again
|
# Chop off verse and start again
|
||||||
xml_string = xml_string[i:]
|
xml_string = xml_string[i:]
|
||||||
#print "C", xml_string
|
#print "C", xml_string
|
||||||
|
@ -163,5 +163,5 @@ class BibleCommon(object):
|
|||||||
text = text[:start_tag] + text[end_tag + 1:]
|
text = text[:start_tag] + text[end_tag + 1:]
|
||||||
start_tag = text.find(u'<')
|
start_tag = text.find(u'<')
|
||||||
text = text.replace(u'>', u'')
|
text = text.replace(u'>', u'')
|
||||||
return text.rstrip()
|
return text.rstrip().lstrip()
|
||||||
|
|
||||||
|
@ -392,12 +392,12 @@ class BibleManager(object):
|
|||||||
book.id, chapter)
|
book.id, chapter)
|
||||||
if v is None:
|
if v is None:
|
||||||
try:
|
try:
|
||||||
self.media.setQuickMessage =\
|
self.media.setQuickMessage(\
|
||||||
unicode(self.media.trUtf8(u'Downloading %s: %s')
|
unicode(self.media.trUtf8(u'Downloading %s: %s'))
|
||||||
% (bookname, chapter))
|
% (bookname, chapter))
|
||||||
search_results = \
|
search_results = \
|
||||||
self.bible_http_cache[bible].get_bible_chapter(
|
self.bible_http_cache[bible].get_bible_chapter(
|
||||||
bible, book.id, bookname, chapter)
|
bible, bookname, chapter)
|
||||||
if search_results.has_verselist():
|
if search_results.has_verselist():
|
||||||
self.bible_db_cache[bible].create_chapter(
|
self.bible_db_cache[bible].create_chapter(
|
||||||
book.id, search_results.get_chapter(),
|
book.id, search_results.get_chapter(),
|
||||||
|
Loading…
Reference in New Issue
Block a user