From 4d1dc4fe054ba03ada537f287c1c2de87a520056 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20D=C5=82ugosz?= Date: Wed, 31 Aug 2011 20:03:16 +0200 Subject: [PATCH] add DRM detection to Gandalf store --- src/calibre/gui2/store/stores/gandalf_plugin.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/store/stores/gandalf_plugin.py b/src/calibre/gui2/store/stores/gandalf_plugin.py index 52e1d296fa..5e3c37e11b 100644 --- a/src/calibre/gui2/store/stores/gandalf_plugin.py +++ b/src/calibre/gui2/store/stores/gandalf_plugin.py @@ -62,6 +62,7 @@ class GandalfStore(BasicStoreConfig, StorePlugin): price = ''.join(data.xpath('.//h3[@class="promocja"]/text()')) price = re.sub('PLN', 'zł', price) price = re.sub('\.', ',', price) + drm = data.xpath('boolean(.//div[@class="info" and contains(., "Zabezpieczenie: DRM")])') counter -= 1 @@ -71,7 +72,10 @@ class GandalfStore(BasicStoreConfig, StorePlugin): s.author = author.strip() s.price = price s.detail_item = id.strip() - s.drm = SearchResult.DRM_UNKNOWN + if drm: + s.drm = SearchResult.DRM_LOCKED + else: + s.drm = SearchResult.DRM_UNLOCKED s.formats = formats.upper().strip() yield s