diff --git a/src/calibre/gui2/store/amazon_de_plugin.py b/src/calibre/gui2/store/amazon_de_plugin.py index 94583f8987..2baa90360c 100644 --- a/src/calibre/gui2/store/amazon_de_plugin.py +++ b/src/calibre/gui2/store/amazon_de_plugin.py @@ -6,7 +6,6 @@ __license__ = 'GPL 3' __copyright__ = '2011, John Schember ' __docformat__ = 'restructuredtext en' - from PyQt4.Qt import QUrl from calibre.gui2 import open_url @@ -20,12 +19,18 @@ class AmazonDEKindleStore(AmazonKindleStore): def open(self, parent=None, detail_item=None, external=False): aff_id = {'tag': 'charhale0a-21'} - store_link = 'http://www.amazon.de/gp/redirect.html?ie=UTF8&location=http://www.amazon.de/&site-redirect=de&tag=%(tag)s&linkCode=ur2&camp=1638&creative=6742' % aff_id + store_link = ('http://www.amazon.de/gp/redirect.html?ie=UTF8&site-redirect=de' + '&tag=%(tag)s&linkCode=ur2&camp=1638&creative=19454' + '&location=http://www.amazon.de/ebooks-kindle/b?node=530886031') % aff_id if detail_item: aff_id['asin'] = detail_item - store_link = 'http://www.amazon.de/gp/redirect.html?ie=UTF8&location=http://www.amazon.de/dp/%(asin)s&site-redirect=de&tag=%(tag)s&linkCode=ur2&camp=1638&creative=6742' % aff_id + store_link = ('http://www.amazon.de/gp/redirect.html?ie=UTF8' + '&location=http://www.amazon.de/dp/%(asin)s&site-redirect=de' + '&tag=%(tag)s&linkCode=ur2&camp=1638&creative=6742') % aff_id open_url(QUrl(store_link)) search_url = 'http://www.amazon.de/s/url=search-alias%3Ddigital-text&field-keywords=' - details_url = 'http://amazon.de/dp/' + details_url = 'http://amazon.de/dp/' + drm_search_text = u'Gleichzeitige Verwendung von Geräten' + drm_free_text = u'Keine Einschränkung' \ No newline at end of file diff --git a/src/calibre/gui2/store/amazon_plugin.py b/src/calibre/gui2/store/amazon_plugin.py index 55fb613288..179c6ffaef 100644 --- a/src/calibre/gui2/store/amazon_plugin.py +++ b/src/calibre/gui2/store/amazon_plugin.py @@ -181,14 +181,19 @@ class AmazonKindleStore(StorePlugin): yield s details_url = 'http://amazon.com/dp/' + drm_search_text = u'Simultaneous Device Usage' + drm_free_text = u'Unlimited' def get_details(self, search_result, timeout): url = self.details_url br = browser() with closing(br.open(url + search_result.detail_item, timeout=timeout)) as nf: idata = html.fromstring(nf.read()) - if idata.xpath('boolean(//div[@class="content"]//li/b[contains(text(), "Simultaneous Device Usage")])'): - if idata.xpath('boolean(//div[@class="content"]//li[contains(., "Unlimited") and contains(b, "Simultaneous Device Usage")])'): + if idata.xpath('boolean(//div[@class="content"]//li/b[contains(text(), "' + + self.drm_search_text + '")])'): + if idata.xpath('boolean(//div[@class="content"]//li[contains(., "' + + self.drm_free_text + '") and contains(b, "' + + self.drm_search_text + '")])'): search_result.drm = SearchResult.DRM_UNLOCKED else: search_result.drm = SearchResult.DRM_UNKNOWN diff --git a/src/calibre/gui2/store/foyles_uk_plugin.py b/src/calibre/gui2/store/foyles_uk_plugin.py index 134f710ef0..b2ad3e5de1 100644 --- a/src/calibre/gui2/store/foyles_uk_plugin.py +++ b/src/calibre/gui2/store/foyles_uk_plugin.py @@ -54,7 +54,10 @@ class FoylesUKStore(BasicStoreConfig, StorePlugin): if not id: continue - cover_url = ''.join(data.xpath('.//div[@class="image"]/a/img/@src')) + cover_url = ''.join(data.xpath('.//a[@class="Jacket"]/img/@src')) + if cover_url: + cover_url = 'http://www.foyles.co.uk' + cover_url + print(cover_url) title = ''.join(data.xpath('.//a[@class="Title"]/text()')) author = ', '.join(data.xpath('.//span[@class="Author"]/text()')) diff --git a/src/calibre/gui2/store/waterstones_uk_plugin.py b/src/calibre/gui2/store/waterstones_uk_plugin.py index 6870f4cf86..d422165c47 100644 --- a/src/calibre/gui2/store/waterstones_uk_plugin.py +++ b/src/calibre/gui2/store/waterstones_uk_plugin.py @@ -58,6 +58,9 @@ class WaterstonesUKStore(BasicStoreConfig, StorePlugin): title = ''.join(data.xpath('./div/div/h2/a/text()')) author = ', '.join(data.xpath('.//p[@class="byAuthor"]/a/text()')) price = ''.join(data.xpath('.//p[@class="price"]/span[@class="priceStandard"]/text()')) + drm = data.xpath('boolean(.//td[@headers="productFormat" and contains(., "DRM")])') + pdf = data.xpath('boolean(.//td[@headers="productFormat" and contains(., "PDF")])') + epub = data.xpath('boolean(.//td[@headers="productFormat" and contains(., "EPUB")])') counter -= 1 @@ -66,8 +69,16 @@ class WaterstonesUKStore(BasicStoreConfig, StorePlugin): s.title = title.strip() s.author = author.strip() s.price = price - s.drm = SearchResult.DRM_LOCKED + if drm: + s.drm = SearchResult.DRM_LOCKED + else: + s.drm = SearchResult.DRM_UNKNOWN s.detail_item = id - s.formats = 'EPUB' + formats = [] + if epub: + formats.append('EPUB') + if pdf: + formats.append('PDF') + s.formats = ', '.join(formats) yield s