mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Minor fix to isbndb.py
This commit is contained in:
parent
f6f96ae97c
commit
3137b37b01
@ -90,10 +90,8 @@ def build_isbn(base_url, opts):
|
||||
return base_url + 'index1=isbn&value1='+opts.isbn
|
||||
|
||||
def build_combined(base_url, opts):
|
||||
query = ''
|
||||
for e in (opts.title, opts.author, opts.publisher):
|
||||
if e is not None:
|
||||
query += ' ' + e
|
||||
query = ' '.join([e for e in (opts.title, opts.author, opts.publisher) \
|
||||
if e is not None ])
|
||||
query = query.strip()
|
||||
if len(query) == 0:
|
||||
raise ISBNDBError('You must specify at least one of --author, --title or --publisher')
|
||||
@ -141,15 +139,8 @@ def create_books(opts, args, timeout=5.):
|
||||
print ('ISBNDB query: '+url)
|
||||
|
||||
tans = [ISBNDBMetadata(book) for book in fetch_metadata(url, timeout=timeout)]
|
||||
ans = []
|
||||
for x in tans:
|
||||
add = True
|
||||
for y in ans:
|
||||
if y.isbn == x.isbn:
|
||||
add = False
|
||||
if add:
|
||||
ans.append(x)
|
||||
return ans
|
||||
#remove duplicates ISBN
|
||||
return dict((book.isbn, book) for book in tans).values()
|
||||
|
||||
def main(args=sys.argv):
|
||||
parser = option_parser()
|
||||
|
Loading…
x
Reference in New Issue
Block a user