This commit is contained in:
Kovid Goyal 2012-12-04 23:40:57 +05:30
commit 40136065f4
2 changed files with 67 additions and 64 deletions

View File

@ -21,6 +21,7 @@ from calibre.utils.localization import get_lang
Option = namedtuple('Option', 'option, default, dest, action, help')
class EPUB_MOBI(CatalogPlugin):
'ePub catalog generator'
@ -386,6 +387,8 @@ class EPUB_MOBI(CatalogPlugin):
if opts.fmt == 'mobi':
recommendations.append(('no_inline_toc', True,
OptionRecommendation.HIGH))
recommendations.append(('verbose', 2,
OptionRecommendation.HIGH))
# Use existing cover or generate new cover
cpath = None
@ -442,4 +445,3 @@ class EPUB_MOBI(CatalogPlugin):
# returns to gui2.actions.catalog:catalog_generated()
return catalog.error

View File

@ -126,7 +126,7 @@ class CatalogBuilder(object):
self.bookmarked_books_by_date_read = None
self.books_by_author = None
self.books_by_date_range = None
self.books_by_description = None
self.books_by_description = []
self.books_by_month = None
self.books_by_series = None
self.books_by_title = None
@ -748,6 +748,7 @@ class CatalogBuilder(object):
# Assumes books_by_title already populated
# init books_by_description before relisting multiple authors
if self.opts.generate_descriptions:
books_by_description = list(books_by_author) if self.opts.sort_descriptions_by_author \
else list(self.books_by_title)
@ -760,6 +761,7 @@ class CatalogBuilder(object):
asl = [i['author_sort'] for i in books_by_author]
las = max(asl, key=len)
if self.opts.generate_descriptions:
self.books_by_description = sorted(books_by_description,
key=lambda x: sort_key(self._kf_books_by_author_sorter_author_sort(x, len(las))))
@ -2973,7 +2975,7 @@ class CatalogBuilder(object):
contentTag = Tag(soup, 'content')
contentTag['src'] = "content/ByDateAdded.html"
navPointTag.insert(1, contentTag)
else:
elif self.opts.generate_descriptions:
# Descriptions only
contentTag = Tag(soup, 'content')
contentTag['src'] = "content/book_%d.html" % int(self.books_by_description[0]['id'])
@ -4103,7 +4105,6 @@ class CatalogBuilder(object):
spine.insert(stc, itemrefTag)
stc += 1
if self.opts.generate_descriptions:
for book in self.books_by_description:
# manifest
itemTag = Tag(soup, "item")