Merge from trunk

This commit is contained in:
Sengian 2010-07-27 19:34:42 +02:00
commit 69baad55fc
4 changed files with 33 additions and 35 deletions

View File

@ -10,7 +10,7 @@ from calibre.web.feeds.news import BasicNewsRecipe
class TagesspiegelRSS(BasicNewsRecipe): class TagesspiegelRSS(BasicNewsRecipe):
title = u'Der Tagesspiegel' title = u'Der Tagesspiegel'
__author__ = 'Ingo Paschke' __author__ = 'Ingo Paschke'
language = 'de' language = 'de'
oldest_article = 7 oldest_article = 7
max_articles_per_feed = 100 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} .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-left{float:left;margin-right:15px;position:relative;}
.hcf-inline-right{float:right;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 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='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='div', attrs={'class':["hcf-jump-to-comments","hcf-clear","hcf-magnify hcf-media-control"] }),
dict(name='span', attrs={'class':["hcf-mainsearch",] }), dict(name='span', attrs={'class':["hcf-mainsearch",] }),
dict(name='ul', attrs={'class':["hcf-tools"]}), dict(name='ul', attrs={'class':["hcf-tools"]}),
dict(name='ul', attrs={'class': re.compile('hcf-services')}) dict(name='ul', attrs={'class': re.compile('hcf-services')})
] ]
def parse_index(self): def parse_index(self):
soup = self.index_to_soup('http://www.tagesspiegel.de/zeitung/') soup = self.index_to_soup('http://www.tagesspiegel.de/zeitung/')
def feed_title(div): 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 = {} articles = {}
key = None key = None
ans = [] 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': if div['class'] == 'hcf-header':
try: try:
key = string.capwords(feed_title(div.em.a)) key = string.capwords(feed_title(div.em.a))
articles[key] = [] articles[key] = []
ans.append(key) ans.append(key)
except: except:
continue continue
elif div['class'] == 'hcf-teaser' and getattr(div.contents[0],'name','') == 'h2': elif div['class'] == 'hcf-teaser' and getattr(div.contents[0],'name','') == 'h2':
a = div.find('a', href=True) 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)] ans = [(key, articles[key]) for key in ans if articles.has_key(key)]
return ans return ans

View File

@ -10,35 +10,34 @@ from calibre.ebooks.BeautifulSoup import Tag
class ZeitDe(BasicNewsRecipe): class ZeitDe(BasicNewsRecipe):
title = 'ZEIT Online Reader Edition' title = 'ZEIT Online'
description = 'ZEIT Online' description = 'ZEIT Online'
language = 'de' language = 'de'
lang = 'de_DE' lang = 'de_DE'
__author__ = 'Martin Pitt, Sujata Raman and Ingo Paschke' __author__ = 'Martin Pitt, Sujata Raman and Ingo Paschke'
use_embedded_content = False use_embedded_content = False
max_articles_per_feed = 100 max_articles_per_feed = 40
remove_empty_feeds = True remove_empty_feeds = True
no_stylesheets = True no_stylesheets = True
no_javascript = True no_javascript = True
encoding = 'utf-8' encoding = 'utf-8'
delay = 0
feeds = [ feeds = [
('Seite 1', 'http://newsfeed.zeit.de/index'), ('Seite 1', 'http://newsfeed.zeit.de/index_xml'),
('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'), ('Politik', 'http://newsfeed.zeit.de/politik/index'),
('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'), ('Wirtschaft', 'http://newsfeed.zeit.de/wirtschaft/index'),
('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'), ('Meinung', 'http://newsfeed.zeit.de/meinung/index'),
('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'), ('Gesellschaft', 'http://newsfeed.zeit.de/gesellschaft/index'),
('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'), ('Kultur', 'http://newsfeed.zeit.de/kultur/index'),
('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'), ('Wissen', 'http://newsfeed.zeit.de/wissen/index'),
('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'), ('Digital', 'http://newsfeed.zeit.de/digital/index'),
('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'), ('Studium', 'http://newsfeed.zeit.de/studium/index'),
('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'), ('Karriere', 'http://newsfeed.zeit.de/karriere/index'),
('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'), ('Lebensart', 'http://newsfeed.zeit.de/lebensart/index'),
('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'), ('Reisen', 'http://newsfeed.zeit.de/reisen/index'),
('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'), ('Auto', 'http://newsfeed.zeit.de/auto/index'),
('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'), ('Sport', 'http://newsfeed.zeit.de/sport/index'),
] ]
extra_css = ''' extra_css = '''
@ -77,7 +76,7 @@ class ZeitDe(BasicNewsRecipe):
ans = article.get('link',None) ans = article.get('link',None)
ans += "?page=all" 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 ans = None
return ans return ans
@ -108,3 +107,4 @@ class ZeitDe(BasicNewsRecipe):
tools.extract() tools.extract()
return soup return soup

View File

@ -84,7 +84,7 @@ class Book(MetaInformation):
def thumbnail(self): def thumbnail(self):
return None 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 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. in C{other} takes precedence, unless the information in C{other} is NULL.

View File

@ -26,7 +26,7 @@ class NOOK(USBMS):
# Ordered list of supported formats # Ordered list of supported formats
FORMATS = ['epub', 'pdb', 'pdf'] FORMATS = ['epub', 'pdb', 'pdf']
VENDOR_ID = [0x2080] VENDOR_ID = [0x2080, 0x18d1] # 0x18d1 is for softrooted nook
PRODUCT_ID = [0x001] PRODUCT_ID = [0x001]
BCD = [0x322] BCD = [0x322]