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)
This commit is contained in:
Kovid Goyal 2018-11-16 09:40:02 +05:30
parent c2895cfbc0
commit 1026635639
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
4 changed files with 68 additions and 56 deletions

View File

@ -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)

View File

@ -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

View File

@ -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)

View File

@ -147,7 +147,7 @@
<x>0</x>
<y>0</y>
<width>373</width>
<height>341</height>
<height>333</height>
</rect>
</property>
<property name="sizePolicy">
@ -164,14 +164,61 @@
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<item row="8" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Max. &amp;number of tags to download:</string>
</property>
<property name="buddy">
<cstring>opt_max_tags</cstring>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Max. &amp;time to wait after first match is found:</string>
</property>
<property name="buddy">
<cstring>opt_wait_after_first_identify_result</cstring>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QSpinBox" name="opt_max_tags"/>
</item>
<item row="9" column="1">
<widget class="QSpinBox" name="opt_wait_after_first_identify_result">
<property name="suffix">
<string> secs</string>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Max. time to wait after first &amp;cover is found:</string>
</property>
<property name="buddy">
<cstring>opt_wait_after_first_cover_result</cstring>
</property>
</widget>
</item>
<item row="10" column="1">
<widget class="QSpinBox" name="opt_wait_after_first_cover_result">
<property name="suffix">
<string> secs</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QCheckBox" name="opt_swap_author_names">
<property name="text">
<string>Swap &amp;author names from FN LN to LN, FN</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="opt_append_comments">
<property name="toolTip">
<string>&lt;p&gt;When downloading comments, append the downloaded comments to any existing comment, instead of overwriting them.</string>
@ -184,14 +231,24 @@
</property>
</widget>
</item>
<item row="6" column="0" colspan="2">
<item row="3" column="0" colspan="2">
<widget class="QCheckBox" name="opt_find_first_edition_date">
<property name="text">
<string>Use &amp;published date of &quot;first edition&quot; (from worldcat.org)</string>
</property>
</widget>
</item>
<item row="9" column="0" colspan="2">
<item row="4" column="0" colspan="2">
<widget class="QCheckBox" name="opt_keep_dups">
<property name="toolTip">
<string>&lt;p&gt;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.</string>
</property>
<property name="text">
<string>Keep more than one entry per source</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<widget class="QCheckBox" name="opt_fewer_tags">
<property name="toolTip">
<string>&lt;p&gt;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 @@
</property>
</widget>
</item>
<item row="10" column="0" colspan="2">
<item row="6" column="0" colspan="2">
<widget class="QPushButton" name="tag_map_rules_button">
<property name="text">
<string>Create &amp;rules to filter/transform tags</string>
</property>
</widget>
</item>
<item row="12" column="0">
<item row="7" column="0" colspan="2">
<widget class="QPushButton" name="author_map_rules_button">
<property name="text">
<string>Create rules to &amp;transform author names</string>
</property>
</widget>
</item>
<item row="13" column="1">
<widget class="QSpinBox" name="opt_max_tags"/>
</item>
<item row="13" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Max. &amp;number of tags to download:</string>
</property>
<property name="buddy">
<cstring>opt_max_tags</cstring>
</property>
</widget>
</item>
<item row="14" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Max. &amp;time to wait after first match is found:</string>
</property>
<property name="buddy">
<cstring>opt_wait_after_first_identify_result</cstring>
</property>
</widget>
</item>
<item row="14" column="1">
<widget class="QSpinBox" name="opt_wait_after_first_identify_result">
<property name="suffix">
<string> secs</string>
</property>
</widget>
</item>
<item row="15" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Max. time to wait after first &amp;cover is found:</string>
</property>
<property name="buddy">
<cstring>opt_wait_after_first_cover_result</cstring>
</property>
</widget>
</item>
<item row="15" column="1">
<widget class="QSpinBox" name="opt_wait_after_first_cover_result">
<property name="suffix">
<string> secs</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>