mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
New recipe for De Volksrant by acidzebra, updated recipe for The Chicago Tribune. Add the the CyBook Opus to the welcome wizard. Fix #3146 (More formats for Bebook/lBook etc)
This commit is contained in:
parent
1f349f330e
commit
30735c5885
@ -270,7 +270,7 @@ class CybookG3Output(OutputProfile):
|
||||
fbase = 16
|
||||
fsizes = [12, 12, 14, 16, 18, 20, 22, 24]
|
||||
|
||||
class CybookOpusOutput(OutputProfile):
|
||||
class CybookOpusOutput(SonyReaderOutput):
|
||||
|
||||
author = 'John Schember'
|
||||
name = 'Cybook Opus'
|
||||
@ -278,7 +278,6 @@ class CybookOpusOutput(OutputProfile):
|
||||
description = _('This profile is intended for the Cybook Opus.')
|
||||
|
||||
# Screen size is a best guess
|
||||
screen_size = (600, 800)
|
||||
dpi = 200
|
||||
fbase = 16
|
||||
fsizes = [12, 12, 14, 16, 18, 20, 22, 24]
|
||||
|
@ -20,7 +20,7 @@ class BEBOOK(USBMS):
|
||||
supported_platforms = ['windows', 'osx', 'linux']
|
||||
|
||||
# Ordered list of supported formats
|
||||
FORMATS = ['mobi', 'epub', 'pdf', 'rtf', 'txt']
|
||||
FORMATS = ['mobi', 'epub', 'fb2', 'lit', 'prc', 'pdf', 'rtf', 'txt']
|
||||
|
||||
VENDOR_ID = [0x0525]
|
||||
PRODUCT_ID = [0x8803, 0x6803]
|
||||
|
@ -181,7 +181,7 @@ def question_dialog(parent, title, msg, det_msg=''):
|
||||
return d.exec_() == QMessageBox.Yes
|
||||
|
||||
def info_dialog(parent, title, msg, det_msg='', show=False):
|
||||
d = MessageBox(QMessageBox.Information, title, msg, QMessageBox.NoButton,
|
||||
d = MessageBox(QMessageBox.Information, title, msg, QMessageBox.Ok,
|
||||
parent, det_msg)
|
||||
d.setIconPixmap(QPixmap(':/images/dialog_information.svg'))
|
||||
if show:
|
||||
|
@ -104,6 +104,7 @@ class CybookOpus(CybookG3):
|
||||
|
||||
name = 'Cybook Opus'
|
||||
output_format = 'EPUB'
|
||||
output_profile = 'cybook_opus'
|
||||
id = 'cybook_opus'
|
||||
|
||||
class BeBook(Device):
|
||||
|
@ -53,6 +53,7 @@ recipe_modules = ['recipe_' + r for r in (
|
||||
'gva_be', 'hln', 'tijd', 'degentenaar', 'inquirer_net', 'uncrate',
|
||||
'fastcompany', 'accountancyage', 'laprensa_hn', 'latribuna',
|
||||
'eltiempo_hn', 'slate', 'tnxm', 'bbcvietnamese', 'vnexpress',
|
||||
'volksrant', 'theeconomictimes_india',
|
||||
)]
|
||||
|
||||
|
||||
|
@ -12,14 +12,35 @@ from threading import RLock
|
||||
class ChicagoTribune(BasicNewsRecipe):
|
||||
|
||||
title = 'Chicago Tribune'
|
||||
__author__ = 'Kovid Goyal'
|
||||
__author__ = 'Kovid Goyal and Sujata Raman'
|
||||
description = 'Politics, local and business news from Chicago'
|
||||
language = _('English')
|
||||
use_embedded_content = False
|
||||
articles_are_obfuscated = True
|
||||
remove_tags_before = dict(name='h1')
|
||||
obfuctation_lock = RLock()
|
||||
no_stylesheets = True
|
||||
remove_javascript = True
|
||||
|
||||
keep_only_tags = [dict(name='div', attrs={'class':["story","entry-asset asset hentry"]}),
|
||||
dict(name='div', attrs={'id':["pagebody","story","maincontentcontainer"]}),
|
||||
]
|
||||
remove_tags_after = [ {'class':['photo_article',]} ]
|
||||
|
||||
remove_tags = [{'id':["moduleArticleTools","content-bottom","rail","articleRelates module","toolSet","relatedrailcontent","div-wrapper","beta","atp-comments","footer"]},
|
||||
{'class':["clearfix","relatedTitle","articleRelates module","asset-footer","tools","comments","featurePromo","featurePromo fp-topjobs brownBackground","clearfix fullSpan brownBackground","curvedContent"]},
|
||||
dict(name='font',attrs={'id':["cr-other-headlines"]})]
|
||||
extra_css = '''
|
||||
h1{font-family:Arial,Helvetica,sans-serif; font-weight:bold;font-size:large;}
|
||||
h2{font-family:Arial,Helvetica,sans-serif; font-weight:normal;font-size:small;}
|
||||
.byline {font-family:Arial,Helvetica,sans-serif; font-size:xx-small;}
|
||||
.date {font-family:Arial,Helvetica,sans-serif; font-size:xx-small;}
|
||||
p{font-family:Arial,Helvetica,sans-serif;font-size:small;}
|
||||
.copyright {font-family:Arial,Helvetica,sans-serif;font-size:xx-small;text-align:center}
|
||||
.story{font-family:Arial,Helvetica,sans-serif;font-size:small;}
|
||||
.entry-asset asset hentry{font-family:Arial,Helvetica,sans-serif;font-size:small;}
|
||||
.pagebody{font-family:Arial,Helvetica,sans-serif;font-size:small;}
|
||||
.maincontentcontainer{font-family:Arial,Helvetica,sans-serif;font-size:small;}
|
||||
.story-body{font-family:Arial,Helvetica,sans-serif;font-size:small;}
|
||||
body{font-family:Helvetica,Arial,sans-serif;font-size:small;}
|
||||
'''
|
||||
feeds = [
|
||||
('Latest news', 'http://feeds.chicagotribune.com/chicagotribune/news/'),
|
||||
('Local news', 'http://feeds.chicagotribune.com/chicagotribune/news/local/'),
|
||||
@ -28,14 +49,14 @@ class ChicagoTribune(BasicNewsRecipe):
|
||||
('Most E-mailed stories', 'http://feeds.chicagotribune.com/chicagotribune/email/'),
|
||||
('Opinion', 'http://feeds.chicagotribune.com/chicagotribune/opinion/'),
|
||||
('Off Topic', 'http://feeds.chicagotribune.com/chicagotribune/offtopic/'),
|
||||
('Politics', 'http://feeds.chicagotribune.com/chicagotribune/politics/'),
|
||||
('Special Reports', 'http://feeds.chicagotribune.com/chicagotribune/special/'),
|
||||
('Religion News', 'http://feeds.chicagotribune.com/chicagotribune/religion/'),
|
||||
#('Politics', 'http://feeds.chicagotribune.com/chicagotribune/politics/'),
|
||||
#('Special Reports', 'http://feeds.chicagotribune.com/chicagotribune/special/'),
|
||||
#('Religion News', 'http://feeds.chicagotribune.com/chicagotribune/religion/'),
|
||||
('Business news', 'http://feeds.chicagotribune.com/chicagotribune/business/'),
|
||||
('Jobs and Careers', 'http://feeds.chicagotribune.com/chicagotribune/career/'),
|
||||
('Local scene', 'http://feeds.chicagotribune.com/chicagohomes/localscene/'),
|
||||
('Phil Rosenthal', 'http://feeds.chicagotribune.com/chicagotribune/rosenthal/'),
|
||||
('Tech Buzz', 'http://feeds.chicagotribune.com/chicagotribune/techbuzz/'),
|
||||
#('Tech Buzz', 'http://feeds.chicagotribune.com/chicagotribune/techbuzz/'),
|
||||
('Your Money', 'http://feeds.chicagotribune.com/chicagotribune/yourmoney/'),
|
||||
('Jon Hilkevitch - Getting around', 'http://feeds.chicagotribune.com/chicagotribune/gettingaround/'),
|
||||
('Jon Yates - What\'s your problem?', 'http://feeds.chicagotribune.com/chicagotribune/problem/'),
|
||||
@ -44,39 +65,30 @@ class ChicagoTribune(BasicNewsRecipe):
|
||||
('Sports', 'http://feeds.chicagotribune.com/chicagotribune/sports/'),
|
||||
('Arts and Architecture', 'http://feeds.chicagotribune.com/chicagotribune/arts/'),
|
||||
('Books', 'http://feeds.chicagotribune.com/chicagotribune/books/'),
|
||||
('Magazine', 'http://feeds.chicagotribune.com/chicagotribune/magazine/'),
|
||||
#('Magazine', 'http://feeds.chicagotribune.com/chicagotribune/magazine/'),
|
||||
('Movies', 'http://feeds.chicagotribune.com/chicagotribune/movies/'),
|
||||
('Music', 'http://feeds.chicagotribune.com/chicagotribune/movies/'),
|
||||
('Music', 'http://feeds.chicagotribune.com/chicagotribune/music/'),
|
||||
('TV', 'http://feeds.chicagotribune.com/chicagotribune/tv/'),
|
||||
('Hypertext', 'http://feeds.chicagotribune.com/chicagotribune/hypertext/'),
|
||||
('iPhone Blog', 'http://feeds.feedburner.com/redeye/iphoneblog'),
|
||||
('Julie\'s Health Club', 'http://feeds.chicagotribune.com/chicagotribune_julieshealthclub/'),
|
||||
]
|
||||
|
||||
temp_files = []
|
||||
|
||||
def get_article_url(self, article):
|
||||
print article.get('feedburner_origlink', article.get('guid', article.get('link')))
|
||||
return article.get('feedburner_origlink', article.get('guid', article.get('link')))
|
||||
|
||||
def get_obfuscated_article(self, url):
|
||||
with self.obfuctation_lock:
|
||||
soup = self.index_to_soup(url)
|
||||
img = soup.find('img', alt='Print')
|
||||
if img is not None:
|
||||
a = img.parent.find('a', href=True)
|
||||
purl = urlparse(url)
|
||||
xurl = urlunparse(purl[:2] + (a['href'], '', '', ''))
|
||||
soup = self.index_to_soup(xurl)
|
||||
for img in soup.findAll('img', src=True):
|
||||
if img['src'].startswith('/'):
|
||||
img['src'] = urlunparse(purl[:2]+(img['src'], '', '', ''))
|
||||
html = unicode(soup)
|
||||
else:
|
||||
h1 = soup.find(id='page-title')
|
||||
body = soup.find(attrs={'class':re.compile('asset-content')})
|
||||
html = u'<html><head/><body>%s</body></html>'%(unicode(h1)+unicode(body))
|
||||
self.temp_files.append(PersistentTemporaryFile('_chicago_tribune.xhtml'))
|
||||
self.temp_files[-1].write(html.encode('utf-8'))
|
||||
self.temp_files[-1].close()
|
||||
return self.temp_files[-1].name
|
||||
|
||||
def postprocess_html(self, soup, first_fetch):
|
||||
for t in soup.findAll(['table', 'tr', 'td']):
|
||||
t.name = 'div'
|
||||
|
||||
for tag in soup.findAll('form', dict(attrs={'name':["comments_form"]})):
|
||||
tag.extract()
|
||||
for tag in soup.findAll('font', dict(attrs={'id':["cr-other-headlines"]})):
|
||||
tag.extract()
|
||||
|
||||
return soup
|
||||
|
||||
|
||||
|
34
src/calibre/web/feeds/recipes/recipe_volksrant.py
Normal file
34
src/calibre/web/feeds/recipes/recipe_volksrant.py
Normal file
@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env python
|
||||
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
|
||||
from __future__ import with_statement
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
from calibre.web.feeds.news import BasicNewsRecipe
|
||||
|
||||
class AdvancedUserRecipe1249039563(BasicNewsRecipe):
|
||||
title = u'De Volkskrant'
|
||||
__author__ = 'acidzebra'
|
||||
oldest_article = 7
|
||||
max_articles_per_feed = 100
|
||||
no_stylesheets = True
|
||||
language = _('Dutch')
|
||||
keep_only_tags = [dict(name='div', attrs={'id':'leftColumnArticle'}) ]
|
||||
remove_tags = [
|
||||
dict(name='div',attrs={'class':'article_tools'}),
|
||||
dict(name='div',attrs={'id':'article_tools'}),
|
||||
dict(name='div',attrs={'class':'articletools'}),
|
||||
dict(name='div',attrs={'id':'articletools'}),
|
||||
dict(name='div',attrs={'id':'myOverlay'}),
|
||||
dict(name='div',attrs={'id':'trackback'}),
|
||||
dict(name='div',attrs={'id':'googleBanner'}),
|
||||
dict(name='div',attrs={'id':'article_headlines'}),
|
||||
]
|
||||
extra_css = '''
|
||||
body{font-family:Arial,Helvetica,sans-serif; font-size:small;}
|
||||
h1{font-size:large;}
|
||||
'''
|
||||
|
||||
feeds = [(u'Laatste Nieuws', u'http://volkskrant.nl/rss/laatstenieuws.rss'), (u'Binnenlands nieuws', u'http://volkskrant.nl/rss/nederland.rss'), (u'Buitenlands nieuws', u'http://volkskrant.nl/rss/internationaal.rss'), (u'Economisch nieuws', u'http://volkskrant.nl/rss/economie.rss'), (u'Sportnieuws', u'http://volkskrant.nl/rss/sport.rss'), (u'Kunstnieuws', u'http://volkskrant.nl/rss/kunst.rss'), (u'Wetenschapsnieuws', u'http://feeds.feedburner.com/DeVolkskrantWetenschap'), (u'Technologienieuws', u'http://feeds.feedburner.com/vkmedia')]
|
Loading…
x
Reference in New Issue
Block a user