forked from openlp/openlp
small cleanups
This commit is contained in:
parent
e8202924f7
commit
23c8ea8679
@ -101,7 +101,7 @@ class CSVBible(BibleDB):
|
||||
success = True
|
||||
language_id = self.get_language()
|
||||
if not language_id:
|
||||
log.exception(u'Importing books from %s " '\
|
||||
log.exception(u'Importing books from "%s" '\
|
||||
'failed' % self.filename)
|
||||
return False
|
||||
books_file = None
|
||||
@ -120,7 +120,7 @@ class CSVBible(BibleDB):
|
||||
book_ref_id = self.get_book_ref_id_by_name(
|
||||
unicode(line[2], details['encoding']), language_id)
|
||||
if not book_ref_id:
|
||||
log.exception(u'Importing books from %s " '\
|
||||
log.exception(u'Importing books from "%s" '\
|
||||
'failed' % self.booksfile)
|
||||
return False
|
||||
book_details = BiblesResourcesDB.get_book_by_id(book_ref_id)
|
||||
|
@ -618,7 +618,8 @@ class BiblesResourcesDB(QtCore.QObject, Manager):
|
||||
``chapter``
|
||||
The chapter number.
|
||||
"""
|
||||
log.debug(u'BiblesResourcesDB.get_chapter("%s", "%s")', book_id, chapter)
|
||||
log.debug(u'BiblesResourcesDB.get_chapter("%s", "%s")', book_id,
|
||||
chapter)
|
||||
if not isinstance(chapter, int):
|
||||
chapter = int(chapter)
|
||||
chapters = BiblesResourcesDB.run_sql(u'SELECT id, book_reference_id, '
|
||||
@ -770,8 +771,8 @@ class BiblesResourcesDB(QtCore.QObject, Manager):
|
||||
u'= ? ORDER BY id', (name, language_id))
|
||||
else:
|
||||
id = BiblesResourcesDB.run_sql(u'SELECT book_reference_id '
|
||||
u'FROM alternative_book_names WHERE name = ? ORDER BY id', (
|
||||
name, ))
|
||||
u'FROM alternative_book_names WHERE name = ? ORDER BY id',
|
||||
(name, ))
|
||||
if id:
|
||||
return int(id[0][0])
|
||||
else:
|
||||
|
@ -147,8 +147,8 @@ class BGExtract(object):
|
||||
return None
|
||||
page_source = page.read()
|
||||
page_source = unicode(page_source, 'utf8')
|
||||
page_source_temp = re.search(u'<table id="booklist".*?>.*?</table>', \
|
||||
page_source, re.DOTALL)
|
||||
page_source_temp = re.search(u'<table id="booklist".*?>.*?</table>', \
|
||||
page_source, re.DOTALL)
|
||||
if page_source_temp:
|
||||
soup = page_source_temp.group(0)
|
||||
else:
|
||||
|
@ -214,7 +214,8 @@ class BibleManager(object):
|
||||
books.append(
|
||||
{
|
||||
u'name': book.name,
|
||||
u'chapters': self.db_cache[bible].get_chapter_count(book.book_reference_id)
|
||||
u'chapters': self.db_cache[bible].get_chapter_count(
|
||||
book.book_reference_id)
|
||||
})
|
||||
return books
|
||||
|
||||
@ -222,7 +223,7 @@ class BibleManager(object):
|
||||
"""
|
||||
Returns the number of Chapters for a given book.
|
||||
"""
|
||||
log.debug(u'BibleManager.get_book_chapter_count ("%s", "%s")', bible,
|
||||
log.debug(u'BibleManager.get_book_chapter_count ("%s", "%s")', bible,
|
||||
book)
|
||||
return self.db_cache[bible].get_chapter_count(book)
|
||||
|
||||
|
@ -59,7 +59,7 @@ class OpenLP1Bible(BibleDB):
|
||||
#Create the bible language
|
||||
language_id = self.get_language()
|
||||
if not language_id:
|
||||
log.exception(u'Importing books from %s " '\
|
||||
log.exception(u'Importing books from "%s " '\
|
||||
'failed' % self.filename)
|
||||
return False
|
||||
# Create all books.
|
||||
@ -76,7 +76,7 @@ class OpenLP1Bible(BibleDB):
|
||||
abbreviation = unicode(book[3], u'cp1252')
|
||||
book_ref_id = self.get_book_ref_id_by_name(name, language_id)
|
||||
if not book_ref_id:
|
||||
log.exception(u'Importing books from %s " '\
|
||||
log.exception(u'Importing books from "%s" '\
|
||||
'failed' % self.filename)
|
||||
return False
|
||||
book_details = BiblesResourcesDB.get_book_by_id(book_ref_id)
|
||||
|
@ -63,7 +63,7 @@ class OpenSongBible(BibleDB):
|
||||
bible = opensong.getroot()
|
||||
language_id = self.get_language()
|
||||
if not language_id:
|
||||
log.exception(u'Importing books from %s " '\
|
||||
log.exception(u'Importing books from "%s" '\
|
||||
'failed' % self.filename)
|
||||
return False
|
||||
for book in bible.b:
|
||||
@ -72,7 +72,7 @@ class OpenSongBible(BibleDB):
|
||||
book_ref_id = self.get_book_ref_id_by_name(
|
||||
unicode(book.attrib[u'n']), language_id)
|
||||
if not book_ref_id:
|
||||
log.exception(u'Importing books from %s " '\
|
||||
log.exception(u'Importing books from "%s" '\
|
||||
'failed' % self.filename)
|
||||
return False
|
||||
book_details = BiblesResourcesDB.get_book_by_id(book_ref_id)
|
||||
|
@ -106,7 +106,7 @@ class OSISBible(BibleDB):
|
||||
# Set meta language_id
|
||||
language_id = self.get_language()
|
||||
if not language_id:
|
||||
log.exception(u'Importing books from %s " '\
|
||||
log.exception(u'Importing books from "%s" '\
|
||||
'failed' % self.filename)
|
||||
return False
|
||||
try:
|
||||
@ -126,7 +126,7 @@ class OSISBible(BibleDB):
|
||||
book_ref_id = self.get_book_ref_id_by_name(
|
||||
unicode(self.books[book][0]), language_id)
|
||||
if not book_ref_id:
|
||||
log.exception(u'Importing books from %s " '\
|
||||
log.exception(u'Importing books from "%s" '\
|
||||
'failed' % self.filename)
|
||||
return False
|
||||
book_details = BiblesResourcesDB.get_book_by_id(
|
||||
|
Loading…
Reference in New Issue
Block a user