From ef5a23e19959f820cfdc6264a0a2240bc866ea9a Mon Sep 17 00:00:00 2001 From: Charles Haley <> Date: Sat, 4 Jun 2011 13:09:01 +0100 Subject: [PATCH 1/5] Fix amazon_uk_plugin.py not to report non-kindle items when amazon provides shotgun results. --- src/calibre/gui2/store/amazon_uk_plugin.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/store/amazon_uk_plugin.py b/src/calibre/gui2/store/amazon_uk_plugin.py index 1448e1548a..fedbfb3709 100644 --- a/src/calibre/gui2/store/amazon_uk_plugin.py +++ b/src/calibre/gui2/store/amazon_uk_plugin.py @@ -75,15 +75,19 @@ class AmazonUKKindleStore(AmazonKindleStore): s.title = title.strip() s.price = price.strip() s.detail_item = asin.strip() - s.formats = 'Kindle' + s.formats = '' + print('is_shot', is_shot) if is_shot: # Amazon UK does not include the author on the grid layout s.author = '' self.get_details(s, timeout) + if s.formats != 'Kindle': + continue else: author = ''.join(data.xpath('.//div[@class="productTitle"]/span[@class="ptBrand"]/text()')) s.author = author.split(' by ')[-1].strip() + s.formats = 'Kindle' yield s @@ -99,6 +103,10 @@ class AmazonUKKindleStore(AmazonKindleStore): idata = html.fromstring(nf.read()) if not search_result.author: search_result.author = ''.join(idata.xpath('//div[@class="buying" and contains(., "Author")]/a/text()')) + is_kindle = idata.xpath('boolean(//div[@class="buying"]/h1/span/span[contains(text(), "Kindle Edition")])') + if is_kindle: + search_result.formats = 'Kindle' + print('az uk', is_kindle) if idata.xpath('boolean(//div[@class="content"]//li/b[contains(text(), "' + self.drm_search_text + '")])'): if idata.xpath('boolean(//div[@class="content"]//li[contains(., "' + From 6a565eb27013e95f47e92a98384b709e7a711598 Mon Sep 17 00:00:00 2001 From: Charles Haley <> Date: Sat, 4 Jun 2011 13:26:51 +0100 Subject: [PATCH 2/5] Remove print statements --- src/calibre/gui2/store/amazon_uk_plugin.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/calibre/gui2/store/amazon_uk_plugin.py b/src/calibre/gui2/store/amazon_uk_plugin.py index fedbfb3709..a922f0516b 100644 --- a/src/calibre/gui2/store/amazon_uk_plugin.py +++ b/src/calibre/gui2/store/amazon_uk_plugin.py @@ -77,7 +77,6 @@ class AmazonUKKindleStore(AmazonKindleStore): s.detail_item = asin.strip() s.formats = '' - print('is_shot', is_shot) if is_shot: # Amazon UK does not include the author on the grid layout s.author = '' @@ -106,7 +105,6 @@ class AmazonUKKindleStore(AmazonKindleStore): is_kindle = idata.xpath('boolean(//div[@class="buying"]/h1/span/span[contains(text(), "Kindle Edition")])') if is_kindle: search_result.formats = 'Kindle' - print('az uk', is_kindle) if idata.xpath('boolean(//div[@class="content"]//li/b[contains(text(), "' + self.drm_search_text + '")])'): if idata.xpath('boolean(//div[@class="content"]//li[contains(., "' + From 5ac8b6bdfa1596109c742e377ae233f9e483dd3c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 4 Jun 2011 09:48:57 -0600 Subject: [PATCH 3/5] Fix error when blanking the column box of a condition in a coloring rule --- src/calibre/gui2/preferences/coloring.py | 31 +++++++++++++----------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/src/calibre/gui2/preferences/coloring.py b/src/calibre/gui2/preferences/coloring.py index 0fca30695b..8a13ead516 100644 --- a/src/calibre/gui2/preferences/coloring.py +++ b/src/calibre/gui2/preferences/coloring.py @@ -159,21 +159,22 @@ class ConditionEditor(QWidget): # {{{ self.action_box.clear() self.action_box.addItem('', '') col = self.current_col - m = self.fm[col] - dt = m['datatype'] - if dt in self.action_map: - actions = self.action_map[dt] - else: - if col == 'ondevice': - k = 'ondevice' - elif col == 'identifiers': - k = 'identifiers' + if col: + m = self.fm[col] + dt = m['datatype'] + if dt in self.action_map: + actions = self.action_map[dt] else: - k = 'multiple' if m['is_multiple'] else 'single' - actions = self.action_map[k] + if col == 'ondevice': + k = 'ondevice' + elif col == 'identifiers': + k = 'identifiers' + else: + k = 'multiple' if m['is_multiple'] else 'single' + actions = self.action_map[k] - for text, key in actions: - self.action_box.addItem(text, key) + for text, key in actions: + self.action_box.addItem(text, key) self.action_box.setCurrentIndex(0) self.action_box.blockSignals(False) self.init_value_box() @@ -184,10 +185,12 @@ class ConditionEditor(QWidget): # {{{ self.value_box.setInputMask('') self.value_box.setValidator(None) col = self.current_col + if not col: + return m = self.fm[col] dt = m['datatype'] action = self.current_action - if not col or not action: + if not action: return tt = '' if col == 'identifiers': From 14970c38c291cd5239830effc1aa084eae914cb5 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 4 Jun 2011 10:08:52 -0600 Subject: [PATCH 4/5] Nook Color: Do not upload cover thumbnails as the NC doesn't need them --- src/calibre/devices/nook/driver.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/calibre/devices/nook/driver.py b/src/calibre/devices/nook/driver.py index 22264c3458..72f2e02508 100644 --- a/src/calibre/devices/nook/driver.py +++ b/src/calibre/devices/nook/driver.py @@ -107,6 +107,9 @@ class NOOK_COLOR(NOOK): return filepath + def upload_cover(self, path, filename, metadata, filepath): + pass + class NOOK_TSR(NOOK): gui_name = _('Nook Simple') description = _('Communicate with the Nook TSR eBook reader.') From 88fa48df840c129ad69601b5beb97d0788df74fc Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 4 Jun 2011 10:15:37 -0600 Subject: [PATCH 5/5] Polizeipresse DE by schuster --- recipes/polizeipress_de.recipe | 35 ++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 recipes/polizeipress_de.recipe diff --git a/recipes/polizeipress_de.recipe b/recipes/polizeipress_de.recipe new file mode 100644 index 0000000000..15114881ea --- /dev/null +++ b/recipes/polizeipress_de.recipe @@ -0,0 +1,35 @@ +from calibre.web.feeds.news import BasicNewsRecipe + +class AdvancedUserRecipe(BasicNewsRecipe): + + title = u'Polizeipresse - Deutschland' + __author__ = 'schuster' + description = 'Tagesaktuelle "Polizeiberichte" aus ganz Deutschland (bis auf Ortsebene).' 'Um deinen Ort/Stadt/Kreis usw. einzubinden, gehe auf "http://www.presseportal.de/polizeipresse/" und suche im oberen "Suchfeld" nach dem Namen.' 'Oberhalb der Suchergebnisse (Folgen:) auf den üblichen link zu den RSS-Feeds klicken und den RSS-link im Rezept unter "feeds" eintragen wie üblich.' 'Die Auswahl von Orten kann vereinfacht werden wenn man den Suchbegriff wie folgt eingibt:' '"Stadt-Ort".' + oldest_article = 21 + max_articles_per_feed = 100 + no_stylesheets = True + use_embedded_content = False + language = 'de' + remove_javascript = True + masthead_url = 'http://www.alt-heliservice.de/images/34_BPOL_Logo_4C_g_schutzbereich.jpg' + cover_url = 'http://berlinstadtservice.de/buerger/Bundespolizei-Logo.png' + + remove_tags = [ + dict(name='div', attrs={'id':'logo'}), + dict(name='div', attrs={'id':'origin'}), + dict(name='pre', attrs={'class':'xml_contact'})] + + def print_version(self,url): + segments = url.split('/') + printURL = 'http://www.presseportal.de/print.htx?nr=' + '/'.join(segments[5:6]) + '&type=polizei' + return printURL + + feeds = [(u'Frimmerdorf', u'http://www.presseportal.de/rss/rss2_vts.htx?q=Grevenbroich-frimmersdorf&w=public_service'), + (u'Neurath', u'http://www.presseportal.de/rss/rss2_vts.htx?q=Grevenbroich-neurath&w=public_service'), + (u'Gustorf', u'http://www.presseportal.de/rss/rss2_vts.htx?q=Grevenbroich-gustorf&w=public_service'), + (u'Neuenhausen', u'http://www.presseportal.de/rss/rss2_vts.htx?q=Grevenbroich-neuenhausen&w=public_service'), + (u'Wevelinghoven', u'http://www.presseportal.de/rss/rss2_vts.htx?q=Grevenbroich-Wevelinghoven&w=public_service'), + (u'Grevenbroich ges.', u'http://www.presseportal.de/rss/rss2_vts.htx?q=grevenbroich&w=public_service'), + (u'Kreis Neuss ges.', u'http://www.presseportal.de/rss/rss2_vts.htx?q=Rhein-Kreis+Neuss&w=public_service'), + ] +