diff --git a/src/calibre/gui2/actions/catalog.py b/src/calibre/gui2/actions/catalog.py index 0eba0406a1..d75b0dfa5a 100644 --- a/src/calibre/gui2/actions/catalog.py +++ b/src/calibre/gui2/actions/catalog.py @@ -57,7 +57,7 @@ class GenerateCatalogAction(InterfaceAction): if job.result: # Search terms nulled catalog results return error_dialog(self.gui, _('No books found'), - _("No books to catalog\nCheck exclusion criteria"), + _("No books to catalog\nCheck job details"), show=True) if job.failed: return self.gui.job_exception(job) diff --git a/src/calibre/library/catalog.py b/src/calibre/library/catalog.py index a9a9caa8db..62d172d6e2 100644 --- a/src/calibre/library/catalog.py +++ b/src/calibre/library/catalog.py @@ -1338,7 +1338,8 @@ class EPUB_MOBI(CatalogPlugin): if self.booksByTitle is None: if not self.fetchBooksByTitle(): return False - self.fetchBooksByAuthor() + if not self.fetchBooksByAuthor(): + return False self.fetchBookmarks() if self.opts.generate_descriptions: self.generateHTMLDescriptions() @@ -1556,7 +1557,10 @@ class EPUB_MOBI(CatalogPlugin): return False 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 + return = Success + ''' self.updateProgressFullStep("Sorting database") @@ -1596,10 +1600,16 @@ class EPUB_MOBI(CatalogPlugin): multiple_authors = True if author != current_author and i: - # Warn if friendly matches previous, but sort doesn't + # Warn, exit if friendly matches previous, but sort doesn't if author[0] == current_author[0]: - self.opts.log.warn("Warning: multiple entries for Author '%s' with differing Author Sort metadata:" % author[0]) - self.opts.log.warn(" '%s' != '%s'" % (author[1], current_author[1])) + error_msg = _("\nWarning: inconsistent Author Sort values for Author '%s', ") % author[0] + error_msg += _("unable to continue building catalog.\n") + error_msg += _("Select all books by '%s', apply same Author Sort value in Edit Metadata dialog, ") % author[0] + error_msg += _("then rebuild the catalog.\n") + error_msg += _("Terminating catalog generation.\n") + + self.opts.log.warn(error_msg) + return False # New author, save the previous author/sort/count unique_authors.append((current_author[0], icu_title(current_author[1]), @@ -1625,6 +1635,7 @@ class EPUB_MOBI(CatalogPlugin): author[2])).encode('utf-8')) self.authors = unique_authors + return True def fetchBookmarks(self): ''' @@ -1739,8 +1750,6 @@ class EPUB_MOBI(CatalogPlugin): # Generate the header from user-customizable template soup = self.generateHTMLDescriptionHeader(title) - - # Write the book entry to contentdir outfile = open("%s/book_%d.html" % (self.contentDir, int(title['id'])), 'w') outfile.write(soup.prettify()) @@ -4350,7 +4359,7 @@ class EPUB_MOBI(CatalogPlugin): _soup = BeautifulSoup('') genresTag = Tag(_soup,'p') gtc = 0 - for (i, tag) in enumerate(book.get('tags', [])): + for (i, tag) in enumerate(sorted(book.get('tags', []))): aTag = Tag(_soup,'a') if self.opts.generate_genres: aTag['href'] = "Genre_%s.html" % re.sub("\W","",tag.lower())