From 6d99bed1603fc5152c62d6c25d186b7733d20756 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 8 May 2017 18:31:15 +0530 Subject: [PATCH] Add Google Books to the options for action on clicking author name --- src/calibre/ebooks/metadata/book/render.py | 9 +++++++-- src/calibre/gui2/preferences/look_feel.py | 2 ++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/metadata/book/render.py b/src/calibre/ebooks/metadata/book/render.py index 6663950efa..db5796c1a7 100644 --- a/src/calibre/ebooks/metadata/book/render.py +++ b/src/calibre/ebooks/metadata/book/render.py @@ -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 diff --git a/src/calibre/gui2/preferences/look_feel.py b/src/calibre/gui2/preferences/look_feel.py index 79dfed745c..cdb2d4051f 100644 --- a/src/calibre/gui2/preferences/look_feel.py +++ b/src/calibre/gui2/preferences/look_feel.py @@ -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)