Have amazon kindle plugin open astore in external browser

This commit is contained in:
John Schember 2011-02-27 14:25:43 -05:00
parent 498b79e6d5
commit 1633c8f8d0
2 changed files with 8 additions and 7 deletions

View File

@ -1047,6 +1047,6 @@ from calibre.gui2.store.feedbooks_plugin import FeedbooksStore
from calibre.gui2.store.manybooks_plugin import ManyBooksStore from calibre.gui2.store.manybooks_plugin import ManyBooksStore
from calibre.gui2.store.smashwords_plugin import SmashwordsStore from calibre.gui2.store.smashwords_plugin import SmashwordsStore
plugins += [GutenbergStore, FeedbooksStore, ManyBooksStore, SmashwordsStore] plugins += [AmazonKindleStore, GutenbergStore, FeedbooksStore, ManyBooksStore, SmashwordsStore]
# }}} # }}}

View File

@ -10,6 +10,8 @@ from contextlib import closing
from lxml import html from lxml import html
from PyQt4.Qt import QUrl
from calibre import browser from calibre import browser
from calibre.customize import StorePlugin from calibre.customize import StorePlugin
from calibre.gui2.store.search_result import SearchResult from calibre.gui2.store.search_result import SearchResult
@ -19,13 +21,12 @@ class AmazonKindleStore(StorePlugin):
name = 'Amazon Kindle' name = 'Amazon Kindle'
description = _('Buy Kindle books from Amazon') description = _('Buy Kindle books from Amazon')
ASTORE_URL = 'http://astore.amazon.com/josbl0e-20/'
def open(self, gui, parent=None, detail_item=None): def open(self, gui, parent=None, detail_item=None):
from calibre.gui2.store.web_store_dialog import WebStoreDialog from calibre.gui2 import open_url
d = WebStoreDialog(gui, self.ASTORE_URL, parent, detail_item) astore_link = 'http://astore.amazon.com/josbl0e-20'
d.setWindowTitle(self.name) if detail_item:
d = d.exec_() astore_link += detail_item
open_url(QUrl(astore_link))
def search(self, query, max_results=10, timeout=60): def search(self, query, max_results=10, timeout=60):
url = 'http://www.amazon.com/s/url=search-alias%3Ddigital-text&field-keywords=' + urllib2.quote(query) url = 'http://www.amazon.com/s/url=search-alias%3Ddigital-text&field-keywords=' + urllib2.quote(query)