From 9a4070d5640d49905f3d61662a1d73efb8ab7fe4 Mon Sep 17 00:00:00 2001 From: GRiker Date: Fri, 14 Jan 2011 09:13:41 -0700 Subject: [PATCH 1/2] add generate_authors switch in GUI, cli --- src/calibre/gui2/catalog/catalog_epub_mobi.ui | 65 +++++++++++-------- src/calibre/library/catalog.py | 24 +++++-- 2 files changed, 56 insertions(+), 33 deletions(-) diff --git a/src/calibre/gui2/catalog/catalog_epub_mobi.ui b/src/calibre/gui2/catalog/catalog_epub_mobi.ui index 7a2a86c690..f443ba4f96 100644 --- a/src/calibre/gui2/catalog/catalog_epub_mobi.ui +++ b/src/calibre/gui2/catalog/catalog_epub_mobi.ui @@ -7,7 +7,7 @@ 0 0 650 - 582 + 596 @@ -41,41 +41,54 @@ Included sections - - - - Books by &Title - - - - - - - Books by &Series - - - - - - - Recently &Added - - - - + Books by &Genre - + + + + Recently &Added + + + + &Descriptions + + + + Books by &Series + + + + + + + Books by &Title + + + + + + + false + + + Books by Author + + + true + + + @@ -332,7 +345,7 @@ p, li { white-space: pre-wrap; } - Matching books will be displayed with ✓ + Matching books will be displayed with a check mark Read books @@ -471,7 +484,7 @@ p, li { white-space: pre-wrap; } - Books tagged as Wishlist items will be displayed with ✕ + Books tagged as Wishlist items will be displayed with an X diff --git a/src/calibre/library/catalog.py b/src/calibre/library/catalog.py index 62d172d6e2..4116f9f9e9 100644 --- a/src/calibre/library/catalog.py +++ b/src/calibre/library/catalog.py @@ -603,6 +603,13 @@ class EPUB_MOBI(CatalogPlugin): "--exclude-tags=skip will match 'skip this book' and 'Skip will like this'.\n" "Default: '%default'\n" "Applies to: ePub, MOBI output formats")), + Option('--generate-authors', + default=True, + dest='generate_authors', + action = 'store_true', + help=_("Include 'Authors' section in catalog.\n" + "Default: '%default'\n" + "Applies to: ePub, MOBI output formats")), Option('--generate-descriptions', default=True, dest='generate_descriptions', @@ -1603,10 +1610,11 @@ class EPUB_MOBI(CatalogPlugin): # Warn, exit if friendly matches previous, but sort doesn't if author[0] == current_author[0]: 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") + "unable to continue building catalog.\n" + "Select all books by '%s', " % author[0] + "apply same Author Sort value in Edit Metadata dialog, " + "then rebuild the catalog.\n" + "Terminating catalog generation.\n") self.opts.log.warn(error_msg) return False @@ -4970,13 +4978,15 @@ class EPUB_MOBI(CatalogPlugin): if opts_dict['ids']: build_log.append(" book count: %d" % len(opts_dict['ids'])) - sections_list = ['Authors'] + sections_list = [] + if opts.generate_authors: + sections_list.append('Authors') if opts.generate_titles: sections_list.append('Titles') - if opts.generate_recently_added: - sections_list.append('Recently Added') if opts.generate_genres: sections_list.append('Genres') + if opts.generate_recently_added: + sections_list.append('Recently Added') if opts.generate_descriptions: sections_list.append('Descriptions') From 7a5c6bb52f36439e74ac6e79388756b4b668c7a3 Mon Sep 17 00:00:00 2001 From: GRiker Date: Fri, 14 Jan 2011 09:24:08 -0700 Subject: [PATCH 2/2] reformat metadata error msg --- src/calibre/library/catalog.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/calibre/library/catalog.py b/src/calibre/library/catalog.py index 4116f9f9e9..f7be9b4b89 100644 --- a/src/calibre/library/catalog.py +++ b/src/calibre/library/catalog.py @@ -607,7 +607,8 @@ class EPUB_MOBI(CatalogPlugin): default=True, dest='generate_authors', action = 'store_true', - help=_("Include 'Authors' section in catalog.\n" + help=_("Include 'Authors' section in catalog." + "This switch is ignored - Books By Author section is always generated." "Default: '%default'\n" "Applies to: ePub, MOBI output formats")), Option('--generate-descriptions', @@ -1609,12 +1610,12 @@ class EPUB_MOBI(CatalogPlugin): if author != current_author and i: # Warn, exit if friendly matches previous, but sort doesn't if author[0] == current_author[0]: - error_msg = _("\nWarning: inconsistent Author Sort values for Author '%s', ") % author[0] - "unable to continue building catalog.\n" - "Select all books by '%s', " % author[0] - "apply same Author Sort value in Edit Metadata dialog, " - "then rebuild the catalog.\n" - "Terminating catalog generation.\n") + error_msg = _(''' +\n*** Metadata error *** +Inconsistent Author Sort values for Author '{0}', unable to continue building catalog. +Select all books by '{0}', apply correct Author Sort value in Edit Metadata dialog, +then rebuild the catalog. +*** Terminating catalog generation ***\n''').format(author[0]) self.opts.log.warn(error_msg) return False