Add Google Books to the options for action on clicking author name

This commit is contained in:
Kovid Goyal 2017-05-08 18:31:15 +05:30
parent f1b1dce050
commit 6d99bed160
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 9 additions and 2 deletions

View File

@ -71,10 +71,13 @@ def author_search_href(which, title=None, author=None):
tt_map = getattr(author_search_href, 'tt_map', None)
if tt_map is None:
tt = _('Search {0} for the author: {1}')
tb = _('Search {0} for the book: {1} by the author {2}')
tt_map = author_search_href.tt_map = {
'goodreads': tt.format('Goodreads', author),
'wikipedia': tt.format('Wikipedia', author),
'goodreads-book': _('Search Goodreads for the book: {0} by the author {1}').format(title, author)
'goodreads-book': tb.format('Goodreads', title, author),
'google': tt.format('Google Books', author),
'google-book': tt.format('Google Books', title, author),
}
tt = tt_map.get(which)
if tt is None:
@ -85,7 +88,9 @@ def author_search_href(which, title=None, author=None):
link_map = author_search_href.link_map = {
'goodreads': 'https://www.goodreads.com/search?q={author}&search%5Bfield%5D=author&search%5Bsource%5D=goodreads&search_type=people&tab=people',
'wikipedia': 'https://en.wikipedia.org/w/index.php?search={author}',
'goodreads-book': 'https://www.goodreads.com/search?q={author}+{title}&search%5Bsource%5D=goodreads&search_type=books&tab=books'
'goodreads-book': 'https://www.goodreads.com/search?q={author}+{title}&search%5Bsource%5D=goodreads&search_type=books&tab=books',
'google': 'https://www.google.co.in/search?tbm=bks&q=inauthor:%22{author}%22',
'google-book': 'https://www.google.co.in/search?tbm=bks&q=inauthor:%22{author}%22+intitle:%22{title}%22',
}
return link_map[which].format(title=qquote(title), author=qquote(author)), tt

View File

@ -63,7 +63,9 @@ class DefaultAuthorLink(QWidget): # {{{
(_('Search for the author on Goodreads'), 'search-goodreads'),
(_('Search for the author in your calibre library'), 'search-calibre'),
(_('Search for the author on Wikipedia'), 'search-wikipedia'),
(_('Search for the author on Google Books'), 'search-google'),
(_('Search for the book on Goodreads'), 'search-goodreads-book'),
(_('Search for the book on Google Books'), 'search-google-book'),
(_('Use a custom search URL'), 'url'),
]:
c.addItem(text, data)