mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Workaround xisbn sometimes returning incomplete isbn pools
This commit is contained in:
parent
16ca0fa068
commit
5e914a5a20
@ -85,6 +85,10 @@ class ISBNMerge(object):
|
||||
isbns, min_year = xisbn.get_isbn_pool(isbn)
|
||||
if not isbns:
|
||||
isbns = frozenset([isbn])
|
||||
if isbns in self.pools:
|
||||
# xISBN had a brain fart
|
||||
pool = self.pools[isbn]
|
||||
else:
|
||||
self.pools[isbns] = pool = (min_year, [])
|
||||
|
||||
if not self.pool_has_result_from_same_source(pool, result):
|
||||
|
@ -45,6 +45,11 @@ class xISBN(object):
|
||||
ans.append(rec)
|
||||
return ans
|
||||
|
||||
def isbns_in_data(self, data):
|
||||
for rec in data:
|
||||
for i in rec.get('isbn', []):
|
||||
yield i
|
||||
|
||||
def get_data(self, isbn):
|
||||
isbn = self.purify(isbn)
|
||||
with self.lock:
|
||||
@ -57,8 +62,7 @@ class xISBN(object):
|
||||
data = []
|
||||
id_ = len(self._data)
|
||||
self._data.append(data)
|
||||
for rec in data:
|
||||
for i in rec.get('isbn', []):
|
||||
for i in self.isbns_in_data(data):
|
||||
self._map[i] = id_
|
||||
self._map[isbn] = id_
|
||||
return self._data[self._map[isbn]]
|
||||
|
Loading…
x
Reference in New Issue
Block a user