From 2b01f9ab68480a1583bf87e3c509ac1cb96cad7e Mon Sep 17 00:00:00 2001 From: John Schember Date: Tue, 19 Apr 2011 21:38:15 -0400 Subject: [PATCH] Store: eharlequin report DRM status. --- src/calibre/gui2/store/eharlequin_plugin.py | 9 ++++++++- src/calibre/gui2/store/search.py | 1 - 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/store/eharlequin_plugin.py b/src/calibre/gui2/store/eharlequin_plugin.py index 1886671b0a..4624732579 100644 --- a/src/calibre/gui2/store/eharlequin_plugin.py +++ b/src/calibre/gui2/store/eharlequin_plugin.py @@ -68,13 +68,20 @@ class EHarlequinStore(BasicStoreConfig, StorePlugin): price = ''.join(data.xpath('.//div[@class="ourprice"]/font/text()')) cover_url = ''.join(data.xpath('.//a[@href="%s"]/img/@src' % id)) + with closing(br.open('http://ebooks.eharlequin.com/' + id.strip(), timeout=timeout/4)) as nf: + idata = html.fromstring(nf.read()) + drm = None + if idata.xpath('boolean(//div[@class="drm_head"])'): + drm = idata.xpath('boolean(//td[contains(., "Copy") and contains(., "not")])') + counter -= 1 - + s = SearchResult() s.cover_url = cover_url s.title = title.strip() s.author = author.strip() s.price = price.strip() s.detail_item = '?url=http://ebooks.eharlequin.com/' + id.strip() + s.drm = drm yield s diff --git a/src/calibre/gui2/store/search.py b/src/calibre/gui2/store/search.py index 61e278afee..e536013e4b 100644 --- a/src/calibre/gui2/store/search.py +++ b/src/calibre/gui2/store/search.py @@ -314,7 +314,6 @@ class SearchThread(Thread): self.tasks.task_done() except: traceback.print_exc() - pass def _clean_query(self, query): query = query.lower()