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'), + ] + 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.') diff --git a/src/calibre/gui2/preferences/coloring.py b/src/calibre/gui2/preferences/coloring.py index b79354a5c9..8a13ead516 100644 --- a/src/calibre/gui2/preferences/coloring.py +++ b/src/calibre/gui2/preferences/coloring.py @@ -159,24 +159,22 @@ class ConditionEditor(QWidget): # {{{ self.action_box.clear() self.action_box.addItem('', '') col = self.current_col - if not col: - self.init_value_box() - return - 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() @@ -187,11 +185,13 @@ class ConditionEditor(QWidget): # {{{ self.value_box.setInputMask('') self.value_box.setValidator(None) col = self.current_col - action = self.current_action - if not col or not action: + if not col: return m = self.fm[col] dt = m['datatype'] + action = self.current_action + if not action: + return tt = '' if col == 'identifiers': tt = _('Enter either an identifier type or an ' @@ -209,7 +209,7 @@ class ConditionEditor(QWidget): # {{{ tt = _('Enter a regular expression') elif m.get('is_multiple', False): tt += '\n' + _('You can match multiple values by separating' - ' them with %s')%m['is_multiple']['ui_to_list'] + ' them with %s')%m['is_multiple'] self.value_box.setToolTip(tt) if action in ('is set', 'is not set', 'is true', 'is false', 'is undefined'): diff --git a/src/calibre/gui2/store/amazon_uk_plugin.py b/src/calibre/gui2/store/amazon_uk_plugin.py index 1448e1548a..a922f0516b 100644 --- a/src/calibre/gui2/store/amazon_uk_plugin.py +++ b/src/calibre/gui2/store/amazon_uk_plugin.py @@ -75,15 +75,18 @@ class AmazonUKKindleStore(AmazonKindleStore): s.title = title.strip() s.price = price.strip() s.detail_item = asin.strip() - s.formats = 'Kindle' + s.formats = '' 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 +102,9 @@ 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' if idata.xpath('boolean(//div[@class="content"]//li/b[contains(text(), "' + self.drm_search_text + '")])'): if idata.xpath('boolean(//div[@class="content"]//li[contains(., "' +