diff --git a/src/calibre/customize/profiles.py b/src/calibre/customize/profiles.py index 757cd09b19..df774bcb55 100644 --- a/src/calibre/customize/profiles.py +++ b/src/calibre/customize/profiles.py @@ -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] diff --git a/src/calibre/devices/bebook/driver.py b/src/calibre/devices/bebook/driver.py index 1542346955..4f5423a93d 100644 --- a/src/calibre/devices/bebook/driver.py +++ b/src/calibre/devices/bebook/driver.py @@ -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] diff --git a/src/calibre/gui2/__init__.py b/src/calibre/gui2/__init__.py index 586424dc4c..a00431460e 100644 --- a/src/calibre/gui2/__init__.py +++ b/src/calibre/gui2/__init__.py @@ -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: diff --git a/src/calibre/gui2/wizard/__init__.py b/src/calibre/gui2/wizard/__init__.py index 8610d8bba7..68e866e7e1 100644 --- a/src/calibre/gui2/wizard/__init__.py +++ b/src/calibre/gui2/wizard/__init__.py @@ -104,6 +104,7 @@ class CybookOpus(CybookG3): name = 'Cybook Opus' output_format = 'EPUB' + output_profile = 'cybook_opus' id = 'cybook_opus' class BeBook(Device): diff --git a/src/calibre/web/feeds/recipes/__init__.py b/src/calibre/web/feeds/recipes/__init__.py index 6e94a3bef8..2dcc48b240 100644 --- a/src/calibre/web/feeds/recipes/__init__.py +++ b/src/calibre/web/feeds/recipes/__init__.py @@ -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', )] diff --git a/src/calibre/web/feeds/recipes/recipe_chicago_tribune.py b/src/calibre/web/feeds/recipes/recipe_chicago_tribune.py index 17608f9ca5..7c747003d2 100644 --- a/src/calibre/web/feeds/recipes/recipe_chicago_tribune.py +++ b/src/calibre/web/feeds/recipes/recipe_chicago_tribune.py @@ -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'
%s'%(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 + diff --git a/src/calibre/web/feeds/recipes/recipe_volksrant.py b/src/calibre/web/feeds/recipes/recipe_volksrant.py new file mode 100644 index 0000000000..d95cbdb1c7 --- /dev/null +++ b/src/calibre/web/feeds/recipes/recipe_volksrant.py @@ -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