Changed booksByTitle when empty list

This commit is contained in:
GRiker 2010-02-12 10:51:41 -07:00
parent 2153d224ea
commit 2091ca2ca4

View File

@ -832,8 +832,7 @@ class EPUB_MOBI(CatalogPlugin):
# Methods # Methods
def buildSources(self): def buildSources(self):
if self.booksByTitle is None: if self.booksByTitle is None:
self.fetchBooksByTitle() if not self.fetchBooksByTitle():
if not len(self.booksByTitle):
return False return False
self.fetchBooksByAuthor() self.fetchBooksByAuthor()
self.generateHTMLDescriptions() self.generateHTMLDescriptions()
@ -996,6 +995,7 @@ class EPUB_MOBI(CatalogPlugin):
titles.append(this_title) titles.append(this_title)
# Re-sort based on title_sort # Re-sort based on title_sort
if len(titles):
self.booksByTitle = sorted(titles, self.booksByTitle = sorted(titles,
key=lambda x:(x['title_sort'].upper(), x['title_sort'].upper())) key=lambda x:(x['title_sort'].upper(), x['title_sort'].upper()))
if False and self.verbose: if False and self.verbose:
@ -1004,6 +1004,9 @@ class EPUB_MOBI(CatalogPlugin):
for title in self.booksByTitle: for title in self.booksByTitle:
self.opts.log.info((u" %-40s %-40s" % (title['title'][0:40], self.opts.log.info((u" %-40s %-40s" % (title['title'][0:40],
title['title_sort'][0:40])).encode('utf-8')) title['title_sort'][0:40])).encode('utf-8'))
return True
else:
return False
def fetchBooksByAuthor(self): def fetchBooksByAuthor(self):
# Generate a list of titles sorted by author from the database # Generate a list of titles sorted by author from the database