mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
commit
17fd2e4782
@ -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)
|
||||
|
@ -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())
|
||||
|
Loading…
x
Reference in New Issue
Block a user