From c39fe2f531645d07168a5cdc1068e993c94c27f0 Mon Sep 17 00:00:00 2001 From: Charles Haley <> Date: Tue, 27 Sep 2011 14:19:52 +0200 Subject: [PATCH] Fix price problem in Foyles. Remove affiliate links from ebook.nl, and remove the 'heart' --- src/calibre/customize/builtins.py | 2 +- src/calibre/gui2/store/stores/ebook_nl_plugin.py | 5 ++--- src/calibre/gui2/store/stores/foyles_uk_plugin.py | 7 +++++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/calibre/customize/builtins.py b/src/calibre/customize/builtins.py index 1474b540ee..c28ec814ba 100644 --- a/src/calibre/customize/builtins.py +++ b/src/calibre/customize/builtins.py @@ -1236,7 +1236,7 @@ class StoreEbookNLStore(StoreBase): headquarters = 'NL' formats = ['EPUB', 'PDF'] - affiliate = True + affiliate = False class StoreEbookscomStore(StoreBase): name = 'eBooks.com' diff --git a/src/calibre/gui2/store/stores/ebook_nl_plugin.py b/src/calibre/gui2/store/stores/ebook_nl_plugin.py index e18ca7de72..0a79026dbb 100644 --- a/src/calibre/gui2/store/stores/ebook_nl_plugin.py +++ b/src/calibre/gui2/store/stores/ebook_nl_plugin.py @@ -23,9 +23,8 @@ from calibre.gui2.store.web_store_dialog import WebStoreDialog class EBookNLStore(BasicStoreConfig, StorePlugin): def open(self, parent=None, detail_item=None, external=False): - url = 'http://ad.zanox.com/ppc/?19015168C29310186T' - url_details = ('http://ad.zanox.com/ppc/?19016028C1098154549T&ULP=[[' - 'http://www.ebook.nl/store/{0}]]') + url = 'http://www.ebook.nl/' + url_details = ('http://www.ebook.nl/store/{0}') if external or self.config.get('open_external', False): if detail_item: diff --git a/src/calibre/gui2/store/stores/foyles_uk_plugin.py b/src/calibre/gui2/store/stores/foyles_uk_plugin.py index fd670d2d85..0e5ccfad01 100644 --- a/src/calibre/gui2/store/stores/foyles_uk_plugin.py +++ b/src/calibre/gui2/store/stores/foyles_uk_plugin.py @@ -6,7 +6,7 @@ __license__ = 'GPL 3' __copyright__ = '2011, John Schember ' __docformat__ = 'restructuredtext en' -import urllib2 +import urllib2, re from contextlib import closing from lxml import html @@ -67,7 +67,10 @@ class FoylesUKStore(BasicStoreConfig, StorePlugin): title = ''.join(data.xpath('.//a[@class="Title"]/text()')) author = ', '.join(data.xpath('.//span[@class="Author"]/text()')) price = ''.join(data.xpath('./ul/li[@class="Strong"]/text()')) - price = price[price.rfind(' '):] + mo = re.search('£[\d\.]+', price) + if mo is None: + continue + price = mo.group(0) counter -= 1