mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
Handle case of no metadata fetchers or fetcher returning None result
This commit is contained in:
parent
4c947784ce
commit
a1c7d0615c
@ -145,7 +145,7 @@ class MetadataSource(Plugin): # {{{
|
|||||||
setattr(w, '_'+x, cb)
|
setattr(w, '_'+x, cb)
|
||||||
cb.setChecked(c.get(x, True))
|
cb.setChecked(c.get(x, True))
|
||||||
w._layout.addWidget(cb)
|
w._layout.addWidget(cb)
|
||||||
|
|
||||||
if self.has_html_comments:
|
if self.has_html_comments:
|
||||||
cb = QCheckBox(_('Convert comments downloaded from %s to plain text')%(self.name))
|
cb = QCheckBox(_('Convert comments downloaded from %s to plain text')%(self.name))
|
||||||
setattr(w, '_textcomments', cb)
|
setattr(w, '_textcomments', cb)
|
||||||
@ -276,12 +276,13 @@ def result_index(source, result):
|
|||||||
return -1
|
return -1
|
||||||
|
|
||||||
def merge_results(one, two):
|
def merge_results(one, two):
|
||||||
for x in two:
|
if two is not None and one is not None:
|
||||||
idx = result_index(one, x)
|
for x in two:
|
||||||
if idx < 0:
|
idx = result_index(one, x)
|
||||||
one.append(x)
|
if idx < 0:
|
||||||
else:
|
one.append(x)
|
||||||
one[idx].smart_update(x)
|
else:
|
||||||
|
one[idx].smart_update(x)
|
||||||
|
|
||||||
class MetadataSources(object):
|
class MetadataSources(object):
|
||||||
|
|
||||||
@ -337,7 +338,7 @@ def search(title=None, author=None, publisher=None, isbn=None, isbndb_key=None,
|
|||||||
manager(title, author, publisher, isbn, verbose)
|
manager(title, author, publisher, isbn, verbose)
|
||||||
manager.join()
|
manager.join()
|
||||||
|
|
||||||
results = list(fetchers[0].results)
|
results = list(fetchers[0].results) if fetchers else []
|
||||||
for fetcher in fetchers[1:]:
|
for fetcher in fetchers[1:]:
|
||||||
merge_results(results, fetcher.results)
|
merge_results(results, fetcher.results)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user