mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-08 17:04:39 +02: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
3 changed files with 13 additions and 2 deletions
|
|
@ -573,8 +573,13 @@ def get_book_url(self, identifiers): # {{{
|
|||
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 @@ def get_book_url(self, identifiers):
|
|||
'''
|
||||
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…
Reference in a new issue