mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
Book details panel: When displaying a link to amazon, use a country specific name like amazon.fr instead of using amazon.com for all countries
This commit is contained in:
parent
029f5c68c5
commit
39a9c59bae
@ -573,8 +573,13 @@ class Amazon(Source):
|
||||
else:
|
||||
url = 'http://www.amazon.%s/dp/%s'%(domain, asin)
|
||||
if url:
|
||||
idtype = 'amazon' if self.domain == 'com' else 'amazon_'+self.domain
|
||||
idtype = 'amazon' if domain == 'com' else 'amazon_'+domain
|
||||
return (idtype, asin, url)
|
||||
|
||||
def get_book_url_name(self, idtype, idval, url):
|
||||
if idtype == 'amazon':
|
||||
return self.name
|
||||
return 'A' + idtype.replace('_', '.')[1:]
|
||||
# }}}
|
||||
|
||||
@property
|
||||
|
@ -443,6 +443,12 @@ class Source(Plugin):
|
||||
'''
|
||||
return None
|
||||
|
||||
def get_book_url_name(self, idtype, idval, url):
|
||||
'''
|
||||
Return a human readable name from the return value of get_book_url().
|
||||
'''
|
||||
return self.name
|
||||
|
||||
def get_cached_cover_url(self, identifiers):
|
||||
'''
|
||||
Return cached cover URL for the book identified by
|
||||
|
@ -517,7 +517,7 @@ def urls_from_identifiers(identifiers): # {{{
|
||||
for plugin in all_metadata_plugins():
|
||||
try:
|
||||
id_type, id_val, url = plugin.get_book_url(identifiers)
|
||||
ans.append((plugin.name, id_type, id_val, url))
|
||||
ans.append((plugin.get_book_url_name(id_type, id_val, url), id_type, id_val, url))
|
||||
except:
|
||||
pass
|
||||
isbn = identifiers.get('isbn', None)
|
||||
|
Loading…
x
Reference in New Issue
Block a user