From e377e66c201582f9a2c8eeb87fbcfb205a60f0e2 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 31 Jan 2015 19:17:41 +0530 Subject: [PATCH] Book Details panel: Allow any identifier of the form url+number to become a clickable link. For example: url1:http://example.com --- src/calibre/ebooks/metadata/sources/identify.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/calibre/ebooks/metadata/sources/identify.py b/src/calibre/ebooks/metadata/sources/identify.py index 44451bbba4..b1385f9648 100644 --- a/src/calibre/ebooks/metadata/sources/identify.py +++ b/src/calibre/ebooks/metadata/sources/identify.py @@ -7,7 +7,7 @@ __license__ = 'GPL v3' __copyright__ = '2011, Kovid Goyal ' __docformat__ = 'restructuredtext en' -import time +import time, re from datetime import datetime from Queue import Queue, Empty from threading import Thread @@ -545,13 +545,13 @@ def urls_from_identifiers(identifiers): # {{{ if issn: ans.append((issn, 'issn', issn, 'http://www.worldcat.org/issn/'+issn)) - for x in ('uri', 'url'): - url = identifiers.get(x, None) - if url and url.startswith('http'): + 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) name = parts.netloc - ans.append((name, x, url, url)) + ans.append((name, k, url, url)) return ans # }}}