From 3c66674bd845f4939ade44e5831ab97f75915b16 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 3 Nov 2009 08:38:14 -0700 Subject: [PATCH] Fix #3926 (Get list of books on device fails with Kindle DX with 0.6.20) --- resources/recipes/cyberpresse.recipe | 25 ++++++++++++------------- src/calibre/devices/nuut2/driver.py | 2 +- src/calibre/ebooks/metadata/meta.py | 1 + 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/resources/recipes/cyberpresse.recipe b/resources/recipes/cyberpresse.recipe index 5de953df3a..25a46e3012 100644 --- a/resources/recipes/cyberpresse.recipe +++ b/resources/recipes/cyberpresse.recipe @@ -1,25 +1,24 @@ -import re from calibre.web.feeds.news import BasicNewsRecipe class Cyberpresse(BasicNewsRecipe): title = u'Cyberpresse' - __author__ = 'balok' + __author__ = 'balok and Sujata Raman' description = 'Canadian news in French' language = 'fr' - + oldest_article = 7 max_articles_per_feed = 100 no_stylesheets = True remove_javascript = True html2lrf_options = ['--left-margin=0','--right-margin=0','--top-margin=0','--bottom-margin=0'] encoding = 'utf-8' - - + + keep_only_tags = [dict(name='div', attrs={'class':'article-page'}), dict(name='div', attrs={'id':'articlePage'}), ] - + extra_css = ''' .photodata{font-family:Arial,Helvetica,Verdana,sans-serif;color: #999999; font-size: 90%; } h1{font-family:Georgia,Times,serif ; font-size: large; } @@ -33,14 +32,14 @@ class Cyberpresse(BasicNewsRecipe): .minithumb-auteurs{font-family:Arial,Helvetica,Verdana,sans-serif; font-size: 90%; } a{color:#003399; font-weight:bold; } ''' - + remove_tags = [ dict(name='div', attrs={'class':['centerbar','colspan','share-module']}), dict(name='p', attrs={'class':['zoom']}), dict(name='ul', attrs={'class':['stories']}), dict(name='h4', attrs={'class':['general-cat']}), ] - + feeds = [(u'Manchettes', u'http://www.cyberpresse.ca/rss/225.xml'), (u'Capitale nationale', u'http://www.cyberpresse.ca/rss/501.xml'), (u'Opinions', u'http://www.cyberpresse.ca/rss/977.xml'), @@ -48,10 +47,10 @@ class Cyberpresse(BasicNewsRecipe): ] def postprocess_html(self, soup, first): - + for tag in soup.findAll(name=['i','strong']): - tag.name = 'div' - + tag.name = 'div' + return soup - - + + diff --git a/src/calibre/devices/nuut2/driver.py b/src/calibre/devices/nuut2/driver.py index ff5b09c2b1..0cfa73f276 100644 --- a/src/calibre/devices/nuut2/driver.py +++ b/src/calibre/devices/nuut2/driver.py @@ -19,7 +19,7 @@ class NUUT2(USBMS): supported_platforms = ['windows', 'osx', 'linux'] # Ordered list of supported formats - FORMATS = ['epub', 'pdft', 'txt'] + FORMATS = ['epub', 'pdf', 'txt'] DRM_FORMATS = ['epub'] VENDOR_ID = [0x140e] diff --git a/src/calibre/ebooks/metadata/meta.py b/src/calibre/ebooks/metadata/meta.py index 2fb70d71b8..857e8e492e 100644 --- a/src/calibre/ebooks/metadata/meta.py +++ b/src/calibre/ebooks/metadata/meta.py @@ -34,6 +34,7 @@ def metadata_from_formats(formats): mi = metadata_from_filename(list(iter(formats))[0]) if not mi.authors: mi.authors = [_('Unknown')] + return mi def _metadata_from_formats(formats): mi = MetaInformation(None, None)