diff --git a/src/calibre/ebooks/metadata/sources/base.py b/src/calibre/ebooks/metadata/sources/base.py index 5ce8e7d6f2..b5b6498530 100644 --- a/src/calibre/ebooks/metadata/sources/base.py +++ b/src/calibre/ebooks/metadata/sources/base.py @@ -489,6 +489,16 @@ class Source(Plugin): ''' return self.name + def get_book_urls(self, identifiers): + ''' + Override this method if you would like to return multiple urls for this book. + Return a list of 3-tuples. By default this method simply calls :method:`get_book_url`. + ''' + data = self.get_book_url(identifiers) + if data is None: + return () + return (data,) + def get_cached_cover_url(self, identifiers): ''' Return cached cover URL for the book identified by diff --git a/src/calibre/ebooks/metadata/sources/identify.py b/src/calibre/ebooks/metadata/sources/identify.py index b1385f9648..4ff63df1d0 100644 --- a/src/calibre/ebooks/metadata/sources/identify.py +++ b/src/calibre/ebooks/metadata/sources/identify.py @@ -521,8 +521,8 @@ def urls_from_identifiers(identifiers): # {{{ ans = [] for plugin in all_metadata_plugins(): try: - id_type, id_val, url = plugin.get_book_url(identifiers) - ans.append((plugin.get_book_url_name(id_type, id_val, url), id_type, id_val, url)) + for id_type, id_val, url in plugin.get_book_urls(identifiers): + ans.append((plugin.get_book_url_name(id_type, id_val, url), id_type, id_val, url)) except: pass isbn = identifiers.get('isbn', None) @@ -546,7 +546,6 @@ def urls_from_identifiers(identifiers): # {{{ ans.append((issn, 'issn', issn, 'http://www.worldcat.org/issn/'+issn)) for k, url in identifiers.iteritems(): - print (k, url) if url and re.match(r'ur[il]\d*$', k) is not None and url.startswith('http'): url = url[:8].replace('|', ':') + url[8:].replace('|', ',') parts = urlparse(url)