mirror of
				https://github.com/kovidgoyal/calibre.git
				synced 2025-11-03 19:17:02 -05:00 
			
		
		
		
	Fix the Douban metadata download plugin
This commit is contained in:
		
							parent
							
								
									6c9d97f2bf
								
							
						
					
					
						commit
						b94b60ac06
					
				@ -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(
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user