From 12f0d53b1ae894d4e91111c4fbdac4b74a8e2f4b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 16 Jun 2009 08:52:28 -0700 Subject: [PATCH] Fix #2607 (Remove non-numerical characters from ISBN when fetching metadata) --- src/calibre/ebooks/metadata/fetch.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/calibre/ebooks/metadata/fetch.py b/src/calibre/ebooks/metadata/fetch.py index f950e1282c..f7a6a559b7 100644 --- a/src/calibre/ebooks/metadata/fetch.py +++ b/src/calibre/ebooks/metadata/fetch.py @@ -3,7 +3,7 @@ __license__ = 'GPL 3' __copyright__ = '2009, Kovid Goyal ' __docformat__ = 'restructuredtext en' -import traceback, sys, textwrap +import traceback, sys, textwrap, re from threading import Thread from calibre import preferred_encoding @@ -90,6 +90,8 @@ def search(title=None, author=None, publisher=None, isbn=None, isbndb_key=None, verbose=0): assert not(title is None and author is None and publisher is None and \ isbn is None) + if isbn is not None: + isbn = re.sub(r'[^a-zA-Z0-9]', '', isbn).upper() fetchers = [FetchGoogle(title, author, publisher, isbn, verbose)] if isbndb_key: fetchers.append(FetchISBNDB(title, author, publisher, isbn, verbose,