From 10266356398170a84fb639690eade9cfd557eeae Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 16 Nov 2018 09:40:02 +0530 Subject: [PATCH] Metadata download: Add an option (in Preferences->Metadata download) to keep multiple results from individual metadata sources, useful if yu prefer to pick the best result by hand and use only one or two metadata sources. Fixes #1802293 [download metadata only keeps one book per source](https://bugs.launchpad.net/calibre/+bug/1802293) --- .../ebooks/metadata/sources/identify.py | 4 +- src/calibre/ebooks/metadata/sources/prefs.py | 1 + .../gui2/preferences/metadata_sources.py | 1 + .../gui2/preferences/metadata_sources.ui | 118 ++++++++++-------- 4 files changed, 68 insertions(+), 56 deletions(-) diff --git a/src/calibre/ebooks/metadata/sources/identify.py b/src/calibre/ebooks/metadata/sources/identify.py index 82c1ac31b6..2861f8435a 100644 --- a/src/calibre/ebooks/metadata/sources/identify.py +++ b/src/calibre/ebooks/metadata/sources/identify.py @@ -165,7 +165,7 @@ class ISBNMerge(object): # Pick only the most relevant result from each source seen = set() for result in results: - if result.identify_plugin not in seen: + if msprefs['keep_dups'] or result.identify_plugin not in seen: seen.add(result.identify_plugin) self.results.append(result) result.average_source_relevance = \ @@ -184,7 +184,7 @@ class ISBNMerge(object): groups = {} for result in self.results: title = lower(result.title if result.title else '') - key = (title, tuple([lower(x) for x in result.authors])) + key = (title, tuple(lower(x) for x in result.authors)) if key not in groups: groups[key] = [] groups[key].append(result) diff --git a/src/calibre/ebooks/metadata/sources/prefs.py b/src/calibre/ebooks/metadata/sources/prefs.py index 7a995f37dc..235f1fff00 100644 --- a/src/calibre/ebooks/metadata/sources/prefs.py +++ b/src/calibre/ebooks/metadata/sources/prefs.py @@ -22,6 +22,7 @@ msprefs.defaults['append_comments'] = False msprefs.defaults['tag_map_rules'] = [] msprefs.defaults['author_map_rules'] = [] msprefs.defaults['id_link_rules'] = {} +msprefs.defaults['keep_dups'] = False # Google covers are often poor quality (scans/errors) but they have high # resolution, so they trump covers from better sources. So make sure they diff --git a/src/calibre/gui2/preferences/metadata_sources.py b/src/calibre/gui2/preferences/metadata_sources.py index 8c4665494a..a9ea411bcd 100644 --- a/src/calibre/gui2/preferences/metadata_sources.py +++ b/src/calibre/gui2/preferences/metadata_sources.py @@ -306,6 +306,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): r('fewer_tags', msprefs) r('find_first_edition_date', msprefs) self.opt_find_first_edition_date.setVisible(False) + r('keep_dups', msprefs) r('append_comments', msprefs) self.configure_plugin_button.clicked.connect(self.configure_plugin) diff --git a/src/calibre/gui2/preferences/metadata_sources.ui b/src/calibre/gui2/preferences/metadata_sources.ui index 13df32f40e..a269bae2bd 100644 --- a/src/calibre/gui2/preferences/metadata_sources.ui +++ b/src/calibre/gui2/preferences/metadata_sources.ui @@ -147,7 +147,7 @@ 0 0 373 - 341 + 333 @@ -164,14 +164,61 @@ - + + + + Max. &number of tags to download: + + + opt_max_tags + + + + + + + Max. &time to wait after first match is found: + + + opt_wait_after_first_identify_result + + + + + + + + + + secs + + + + + + + Max. time to wait after first &cover is found: + + + opt_wait_after_first_cover_result + + + + + + + secs + + + + Swap &author names from FN LN to LN, FN - + <p>When downloading comments, append the downloaded comments to any existing comment, instead of overwriting them. @@ -184,14 +231,24 @@ - + Use &published date of "first edition" (from worldcat.org) - + + + + <p>Normally, the metadata download system will keep only a single result per metadata source. This option will cause it to keep all results returned from every metadata source. useful if you only use one or two sources and want to select individual results from them by hand. Note that result with identical title/author/identifiers are still merged. + + + Keep more than one entry per source + + + + <p>Different metadata sources have different sets of tags for the same book. If this option is checked, then calibre will use the smaller tag sets. These tend to be more like genres, while the larger tag sets tend to describe the books content. @@ -205,67 +262,20 @@ - + Create &rules to filter/transform tags - + Create rules to &transform author names - - - - - - - Max. &number of tags to download: - - - opt_max_tags - - - - - - - Max. &time to wait after first match is found: - - - opt_wait_after_first_identify_result - - - - - - - secs - - - - - - - Max. time to wait after first &cover is found: - - - opt_wait_after_first_cover_result - - - - - - - secs - - -