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
|
return base_url + 'index1=isbn&value1='+opts.isbn
|
||||||
|
|
||||||
def build_combined(base_url, opts):
|
def build_combined(base_url, opts):
|
||||||
query = ''
|
query = ' '.join([e for e in (opts.title, opts.author, opts.publisher) \
|
||||||
for e in (opts.title, opts.author, opts.publisher):
|
if e is not None ])
|
||||||
if e is not None:
|
|
||||||
query += ' ' + e
|
|
||||||
query = query.strip()
|
query = query.strip()
|
||||||
if len(query) == 0:
|
if len(query) == 0:
|
||||||
raise ISBNDBError('You must specify at least one of --author, --title or --publisher')
|
raise ISBNDBError('You must specify at least one of --author, --title or --publisher')
|
||||||
@ -139,17 +137,10 @@ def create_books(opts, args, timeout=5.):
|
|||||||
|
|
||||||
if opts.verbose:
|
if opts.verbose:
|
||||||
print ('ISBNDB query: '+url)
|
print ('ISBNDB query: '+url)
|
||||||
|
|
||||||
tans = [ISBNDBMetadata(book) for book in fetch_metadata(url, timeout=timeout)]
|
tans = [ISBNDBMetadata(book) for book in fetch_metadata(url, timeout=timeout)]
|
||||||
ans = []
|
#remove duplicates ISBN
|
||||||
for x in tans:
|
return dict((book.isbn, book) for book in tans).values()
|
||||||
add = True
|
|
||||||
for y in ans:
|
|
||||||
if y.isbn == x.isbn:
|
|
||||||
add = False
|
|
||||||
if add:
|
|
||||||
ans.append(x)
|
|
||||||
return ans
|
|
||||||
|
|
||||||
def main(args=sys.argv):
|
def main(args=sys.argv):
|
||||||
parser = option_parser()
|
parser = option_parser()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user