From 7b1a065519d7f1a649d93d815f3c17cf257f398f Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 27 Jul 2010 08:19:00 -0600 Subject: [PATCH 1/3] Fix #6303 (enhanced "Die Zeit Nachrichten"-recipe) --- resources/recipes/zeitde.recipe | 36 ++++++++++++++++----------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/resources/recipes/zeitde.recipe b/resources/recipes/zeitde.recipe index a86359c068..ac24225a45 100644 --- a/resources/recipes/zeitde.recipe +++ b/resources/recipes/zeitde.recipe @@ -10,35 +10,34 @@ from calibre.ebooks.BeautifulSoup import Tag class ZeitDe(BasicNewsRecipe): - title = 'ZEIT Online Reader Edition' + title = 'ZEIT Online' description = 'ZEIT Online' language = 'de' lang = 'de_DE' __author__ = 'Martin Pitt, Sujata Raman and Ingo Paschke' use_embedded_content = False - max_articles_per_feed = 100 + max_articles_per_feed = 40 remove_empty_feeds = True no_stylesheets = True no_javascript = True encoding = 'utf-8' - delay = 0 feeds = [ - ('Seite 1', 'http://newsfeed.zeit.de/index'), - ('Politik', 'http://www.zeit.de/solr/select/?q=ressort:%22Politik%22%20type:article&version=2.2&start=0&rows=50&sort=date-first-released%20desc&indent=on&wt=xslt&tr=solr2rss.xsl'), - ('Wirtschaft', 'http://www.zeit.de/solr/select/?q=ressort:%22Wirtschaft%22%20type:article&version=2.2&start=0&rows=50&sort=date-first-released%20desc&indent=on&wt=xslt&tr=solr2rss.xsl'), - ('Meinung', 'http://www.zeit.de/solr/select/?q=ressort:%22Meinung%22%20type:article&version=2.2&start=0&rows=50&sort=date-first-released%20desc&indent=on&wt=xslt&tr=solr2rss.xsl'), - ('Gesellschaft', 'http://www.zeit.de/solr/select/?q=ressort:%22Gesellschaft%22%20type:article&version=2.2&start=0&rows=50&sort=date-first-released%20desc&indent=on&wt=xslt&tr=solr2rss.xsl'), - ('Kultur', 'http://www.zeit.de/solr/select/?q=ressort:%22Kultur%22%20type:article&version=2.2&start=0&rows=50&sort=date-first-released%20desc&indent=on&wt=xslt&tr=solr2rss.xsl'), - ('Wissen', 'http://www.zeit.de/solr/select/?q=ressort:%22Wissen%22%20type:article&version=2.2&start=0&rows=50&sort=date-first-released%20desc&indent=on&wt=xslt&tr=solr2rss.xsl'), - ('Digital', 'http://www.zeit.de/solr/select/?q=ressort:%22Digital%22%20type:article&version=2.2&start=0&rows=50&sort=date-first-released%20desc&indent=on&wt=xslt&tr=solr2rss.xsl'), - ('Studium', 'http://www.zeit.de/solr/select/?q=ressort:%22Studium%22%20type:article&version=2.2&start=0&rows=50&sort=date-first-released%20desc&indent=on&wt=xslt&tr=solr2rss.xsl'), - ('Karriere', 'http://www.zeit.de/solr/select/?q=ressort:%22Karriere%22%20type:article&version=2.2&start=0&rows=50&sort=date-first-released%20desc&indent=on&wt=xslt&tr=solr2rss.xsl'), - ('Lebensart', 'http://www.zeit.de/solr/select/?q=ressort:%22Lebensart%22%20type:article&version=2.2&start=0&rows=50&sort=date-first-released%20desc&indent=on&wt=xslt&tr=solr2rss.xsl'), - ('Reisen', 'http://www.zeit.de/solr/select/?q=ressort:%22Reisen%22%20type:article&version=2.2&start=0&rows=50&sort=date-first-released%20desc&indent=on&wt=xslt&tr=solr2rss.xsl'), - ('Auto', 'http://www.zeit.de/solr/select/?q=ressort:%22Auto%22%20type:article&version=2.2&start=0&rows=50&sort=date-first-released%20desc&indent=on&wt=xslt&tr=solr2rss.xsl'), - ('Sport', 'http://www.zeit.de/solr/select/?q=ressort:%22Sport%22%20type:article&version=2.2&start=0&rows=50&sort=date-first-released%20desc&indent=on&wt=xslt&tr=solr2rss.xsl'), + ('Seite 1', 'http://newsfeed.zeit.de/index_xml'), + ('Politik', 'http://newsfeed.zeit.de/politik/index'), + ('Wirtschaft', 'http://newsfeed.zeit.de/wirtschaft/index'), + ('Meinung', 'http://newsfeed.zeit.de/meinung/index'), + ('Gesellschaft', 'http://newsfeed.zeit.de/gesellschaft/index'), + ('Kultur', 'http://newsfeed.zeit.de/kultur/index'), + ('Wissen', 'http://newsfeed.zeit.de/wissen/index'), + ('Digital', 'http://newsfeed.zeit.de/digital/index'), + ('Studium', 'http://newsfeed.zeit.de/studium/index'), + ('Karriere', 'http://newsfeed.zeit.de/karriere/index'), + ('Lebensart', 'http://newsfeed.zeit.de/lebensart/index'), + ('Reisen', 'http://newsfeed.zeit.de/reisen/index'), + ('Auto', 'http://newsfeed.zeit.de/auto/index'), + ('Sport', 'http://newsfeed.zeit.de/sport/index'), ] extra_css = ''' @@ -77,7 +76,7 @@ class ZeitDe(BasicNewsRecipe): ans = article.get('link',None) ans += "?page=all" - if 'video' in ans or 'quiz' or 'blog.zeit.de/' in ans : + if 'video' in ans or 'quiz' in ans : ans = None return ans @@ -108,3 +107,4 @@ class ZeitDe(BasicNewsRecipe): tools.extract() return soup + From 8dbaaaa37be884d00fb9ca801d34bff3e0da95f2 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 27 Jul 2010 08:21:40 -0600 Subject: [PATCH 2/3] Fix #6302 (a change in the index-page broke the "Der Tagesspiegel"-recipe) --- resources/recipes/tagesspiegel.recipe | 28 +++++++++++++-------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/resources/recipes/tagesspiegel.recipe b/resources/recipes/tagesspiegel.recipe index 3129820e2c..b355a72ebd 100644 --- a/resources/recipes/tagesspiegel.recipe +++ b/resources/recipes/tagesspiegel.recipe @@ -10,7 +10,7 @@ from calibre.web.feeds.news import BasicNewsRecipe class TagesspiegelRSS(BasicNewsRecipe): title = u'Der Tagesspiegel' - __author__ = 'Ingo Paschke' + __author__ = 'Ingo Paschke' language = 'de' oldest_article = 7 max_articles_per_feed = 100 @@ -26,7 +26,7 @@ class TagesspiegelRSS(BasicNewsRecipe): .quote .cite{font-family:Georgia,Palatino,Palatino Linotype,FreeSerif,serif;font-size:xx-small} .hcf-inline-left{float:left;margin-right:15px;position:relative;} .hcf-inline-right{float:right;margin-right:15px;position:relative;} - .hcf-smart-box{font-family: Arial, Helvetica, sans-serif; font-size: xx-small; margin: 0px 15px 8px 0px; width: 300px;} + .hcf-smart-box{font-family: Arial, Helvetica, sans-serif; font-size: xx-small; margin: 0px 15px 8px 0px; width: 300px;} ''' no_stylesheets = True @@ -39,30 +39,30 @@ class TagesspiegelRSS(BasicNewsRecipe): dict(name='link'), dict(name='iframe'),dict(name='style'),dict(name='meta'),dict(name='button'), dict(name='div', attrs={'class':["hcf-jump-to-comments","hcf-clear","hcf-magnify hcf-media-control"] }), dict(name='span', attrs={'class':["hcf-mainsearch",] }), - dict(name='ul', attrs={'class':["hcf-tools"]}), - dict(name='ul', attrs={'class': re.compile('hcf-services')}) + dict(name='ul', attrs={'class':["hcf-tools"]}), + dict(name='ul', attrs={'class': re.compile('hcf-services')}) ] def parse_index(self): soup = self.index_to_soup('http://www.tagesspiegel.de/zeitung/') def feed_title(div): - return ''.join(div.findAll(text=True, recursive=False)).strip() if div is not None else None + return ''.join(div.findAll(text=True, recursive=False)).strip() if div is not None else None articles = {} key = None ans = [] - maincol = soup.find('div', attrs={'class':re.compile('hcf-main-col')}) + maincol = soup.find('div', attrs={'class':re.compile('hcf-main-col')}) - for div in maincol.findAll(True, attrs={'class':['hcf-teaser', 'hcf-header', 'story headline']}): + for div in maincol.findAll(True, attrs={'class':['hcf-teaser', 'hcf-header', 'story headline']}): if div['class'] == 'hcf-header': - try: - key = string.capwords(feed_title(div.em.a)) - articles[key] = [] - ans.append(key) - except: - continue + try: + key = string.capwords(feed_title(div.em.a)) + articles[key] = [] + ans.append(key) + except: + continue elif div['class'] == 'hcf-teaser' and getattr(div.contents[0],'name','') == 'h2': a = div.find('a', href=True) @@ -88,5 +88,3 @@ class TagesspiegelRSS(BasicNewsRecipe): ans = [(key, articles[key]) for key in ans if articles.has_key(key)] return ans - - From e8b2270000a4a14b353c3be31c41d52404466599 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 27 Jul 2010 11:23:36 -0600 Subject: [PATCH 3/3] Fix regression that broke Kobo driver. Add support or 1.41 softrooted nook --- src/calibre/devices/kobo/books.py | 2 +- src/calibre/devices/nook/driver.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/devices/kobo/books.py b/src/calibre/devices/kobo/books.py index 7ee5beaec0..a5b2e98d2f 100644 --- a/src/calibre/devices/kobo/books.py +++ b/src/calibre/devices/kobo/books.py @@ -84,7 +84,7 @@ class Book(MetaInformation): def thumbnail(self): return None - def smart_update(self, other): + def smart_update(self, other, replace_metadata=False): ''' Merge the information in C{other} into self. In case of conflicts, the information in C{other} takes precedence, unless the information in C{other} is NULL. diff --git a/src/calibre/devices/nook/driver.py b/src/calibre/devices/nook/driver.py index 5793dc7187..f697ee5202 100644 --- a/src/calibre/devices/nook/driver.py +++ b/src/calibre/devices/nook/driver.py @@ -26,7 +26,7 @@ class NOOK(USBMS): # Ordered list of supported formats FORMATS = ['epub', 'pdb', 'pdf'] - VENDOR_ID = [0x2080] + VENDOR_ID = [0x2080, 0x18d1] # 0x18d1 is for softrooted nook PRODUCT_ID = [0x001] BCD = [0x322]