This commit is contained in:
Kovid Goyal 2020-03-03 19:57:54 +05:30
commit 31b451d4f3
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -85,7 +85,7 @@ class Douban(Source):
description = entry_.get('summary')
# subtitle = entry_.get('subtitle') # TODO: std metada doesn't have this field
publisher = entry_.get('publisher')
isbns = entry_.get('isbn13') # ISBN11 is obsolute, use ISBN13
isbn = entry_.get('isbn13') # ISBN11 is obsolute, use ISBN13
pubdate = entry_.get('pubdate')
authors = entry_.get('author')
book_tags = entry_.get('tags')
@ -106,7 +106,12 @@ class Douban(Source):
# mi.subtitle = subtitle
# ISBN
for x in isbns:
isbns = []
if isinstance(isbn, basestring):
if check_isbn(isbn):
isbns.append(isbn)
else:
for x in isbn:
if check_isbn(x):
isbns.append(x)
if isbns:
@ -335,10 +340,15 @@ class Douban(Source):
log.exception('Failed to make identify query: %r' % query)
return as_unicode(e)
try:
entries = json.loads(raw)['books']
j = json.loads(raw)
except Exception as e:
log.exception('Failed to parse identify results')
return as_unicode(e)
if j.has_key('books'):
entries = j['books']
else:
entries = []
entries.append(j)
if not entries and identifiers and title and authors and \
not abort.is_set():
return self.identify(