diff --git a/src/calibre/gui2/catalog/catalog_epub_mobi.py b/src/calibre/gui2/catalog/catalog_epub_mobi.py index 1ed11a55d7..04a5fe9527 100644 --- a/src/calibre/gui2/catalog/catalog_epub_mobi.py +++ b/src/calibre/gui2/catalog/catalog_epub_mobi.py @@ -239,10 +239,11 @@ class PluginWidget(QWidget,Ui_Form): def initialize(self, name, db): ''' - CheckBoxControls (c_type: check_box): - ['generate_titles','generate_series','generate_genres', - 'generate_recently_added','generate_descriptions','include_hr'] + ['cross_reference_authors', + 'generate_titles','generate_series','generate_genres', + 'generate_recently_added','generate_descriptions', + 'include_hr'] ComboBoxControls (c_type: combo_box): ['exclude_source_field','header_note_source_field', 'merge_source_field'] diff --git a/src/calibre/gui2/catalog/catalog_epub_mobi.ui b/src/calibre/gui2/catalog/catalog_epub_mobi.ui index b32e596f54..5c016ffdb5 100644 --- a/src/calibre/gui2/catalog/catalog_epub_mobi.ui +++ b/src/calibre/gui2/catalog/catalog_epub_mobi.ui @@ -305,7 +305,7 @@ The default pattern \[.+\]|\+ excludes tags of the form [tag], e.g., [Test book] Other options - + @@ -372,7 +372,7 @@ The default pattern \[.+\]|\+ excludes tags of the form [tag], e.g., [Test book] - + @@ -397,7 +397,7 @@ The default pattern \[.+\]|\+ excludes tags of the form [tag], e.g., [Test book] - + @@ -413,7 +413,7 @@ The default pattern \[.+\]|\+ excludes tags of the form [tag], e.g., [Test book] - + @@ -447,7 +447,7 @@ The default pattern \[.+\]|\+ excludes tags of the form [tag], e.g., [Test book] - + E&xtra Description note: @@ -460,7 +460,7 @@ The default pattern \[.+\]|\+ excludes tags of the form [tag], e.g., [Test book] - + @@ -561,6 +561,27 @@ The default pattern \[.+\]|\+ excludes tags of the form [tag], e.g., [Test book] + + + + Author cross-references: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + For books with multiple authors, list each author separately + + + + + diff --git a/src/calibre/library/catalogs/epub_mobi.py b/src/calibre/library/catalogs/epub_mobi.py index 251db5cf88..de56e27e6e 100644 --- a/src/calibre/library/catalogs/epub_mobi.py +++ b/src/calibre/library/catalogs/epub_mobi.py @@ -41,6 +41,13 @@ class EPUB_MOBI(CatalogPlugin): help = _('Title of generated catalog used as title in metadata.\n' "Default: '%default'\n" "Applies to: AZW3, ePub, MOBI output formats")), + Option('--cross-reference-authors', + default=False, + dest='cross_reference_authors', + action = 'store_true', + help=_("Create cross-references in Authors section for books with multiple authors.\n" + "Default: '%default'\n" + "Applies to: AZW3, ePub, MOBI output formats")), Option('--debug-pipeline', default=None, dest='debug_pipeline', @@ -58,7 +65,6 @@ class EPUB_MOBI(CatalogPlugin): help=_("Regex describing tags to exclude as genres.\n" "Default: '%default' excludes bracketed tags, e.g. '[Project Gutenberg]', and '+', the default tag for read books.\n" "Applies to: AZW3, ePub, MOBI output formats")), - Option('--exclusion-rules', default="(('Catalogs','Tags','Catalog'),)", dest='exclusion_rules', @@ -72,7 +78,6 @@ class EPUB_MOBI(CatalogPlugin): "When multiple rules are defined, all rules will be applied.\n" "Default: \n" + '"' + '%default' + '"' + "\n" "Applies to AZW3, ePub, MOBI output formats")), - Option('--generate-authors', default=False, dest='generate_authors', @@ -318,8 +323,8 @@ class EPUB_MOBI(CatalogPlugin): build_log.append(" opts:") for key in keys: if key in ['catalog_title','author_clip','connected_kindle','creator', - 'description_clip','exclude_book_marker','exclude_genre', - 'exclude_tags','exclusion_rules', 'fmt', + 'cross_reference_authors','description_clip','exclude_book_marker', + 'exclude_genre','exclude_tags','exclusion_rules', 'fmt', 'header_note_source_field','merge_comments_rule', 'output_profile','prefix_rules','read_book_marker', 'search_text','sort_by','sort_descriptions_by_author','sync', diff --git a/src/calibre/library/catalogs/epub_mobi_builder.py b/src/calibre/library/catalogs/epub_mobi_builder.py index 58712cf3d3..dbc73925b6 100644 --- a/src/calibre/library/catalogs/epub_mobi_builder.py +++ b/src/calibre/library/catalogs/epub_mobi_builder.py @@ -727,7 +727,8 @@ class CatalogBuilder(object): books_by_author = list(self.books_to_catalog) self.detect_author_sort_mismatches(books_by_author) - books_by_author = self.relist_multiple_authors(books_by_author) + if self.opts.cross_reference_authors: + books_by_author = self.relist_multiple_authors(books_by_author) #books_by_author = sorted(list(books_by_author), key=self._kf_books_by_author_sorter_author) @@ -4720,17 +4721,10 @@ class CatalogBuilder(object): with multiple authors Return: - (list): books_by_author with additional entries for books with + (list): books_by_author with additional cloned entries for books with multiple authors """ - # Scan list looking for entries with len(authors) > 1 - # Clone multiples, swapping additional author into first place, - # computing author_sort to match - - # from calibre.ebooks.metadata import authors_to_string - # return authors_to_string(self.authors) - multiple_author_books = [] # Find the multiple author books @@ -4749,7 +4743,6 @@ class CatalogBuilder(object): new_book['authors'] = list(cloned_authors) asl = [author_to_author_sort(auth) for auth in cloned_authors] new_book['author_sort'] = ' & '.join(asl) - #print("'%s' (%s) (%s)" % (new_book['title'], new_book['authors'], new_book['author_sort'])) books_by_author.append(new_book) return books_by_author