From d1e49d92678c687976af099fa1d948abe899c49c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 9 Jun 2010 20:04:56 -0600 Subject: [PATCH 1/2] Conversion pipeline: Handle missing/obsolete input/output profiles gracefully --- src/calibre/ebooks/conversion/plumber.py | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/calibre/ebooks/conversion/plumber.py b/src/calibre/ebooks/conversion/plumber.py index e227ad2c8e..24b35f804f 100644 --- a/src/calibre/ebooks/conversion/plumber.py +++ b/src/calibre/ebooks/conversion/plumber.py @@ -706,15 +706,22 @@ OptionRecommendation(name='timestamp', for rec in group: setattr(self.opts, rec.option.name, rec.recommended_value) - for x in input_profiles(): - if x.short_name == self.opts.input_profile: - self.opts.input_profile = x - break + def set_profile(profiles, which): + attr = which + '_profile' + sval = getattr(self.opts, attr) + for x in profiles(): + if x.short_name == sval: + setattr(self.opts, attr, x) + return + self.log.warn( + 'Profile (%s) %r is no longer available, using default'%(which, sval)) + for x in profiles(): + if x.short_name == 'default': + setattr(self.opts, attr, x) + break - for x in output_profiles(): - if x.short_name == self.opts.output_profile: - self.opts.output_profile = x - break + set_profile(input_profiles, 'input') + set_profile(output_profiles, 'output') self.read_user_metadata() self.opts.no_inline_navbars = self.opts.output_profile.supports_mobi_indexing \ From a42985c57c0f673fd9216c5ee37c75882bfcf45e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 9 Jun 2010 21:00:36 -0600 Subject: [PATCH 2/2] Fix #5777 (New recipe for blog Reptantes in Spanish) --- resources/recipes/reptantes.recipe | 43 ++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 resources/recipes/reptantes.recipe diff --git a/resources/recipes/reptantes.recipe b/resources/recipes/reptantes.recipe new file mode 100644 index 0000000000..51b65c6639 --- /dev/null +++ b/resources/recipes/reptantes.recipe @@ -0,0 +1,43 @@ + +__license__ = 'GPL v3' +__copyright__ = '2010, Darko Miletic ' +''' +www.reptantes.com.ar +''' + +from calibre.web.feeds.news import BasicNewsRecipe + +class Reptantes(BasicNewsRecipe): + title = 'Reptantes' + __author__ = 'Darko Miletic' + description = u"cada vez que te haces acupuntura, tu muñeco vudú sufre en algún lado" + oldest_article = 130 + max_articles_per_feed = 100 + language = 'es' + encoding = 'utf-8' + no_stylesheets = True + use_embedded_content = False + publication_type = 'blog' + extra_css = ' body{font-family: "Palatino Linotype",serif} h2{text-align: center; color:#BE7F8D} img{margin-bottom: 2em} ' + + conversion_options = { + 'comment' : description + , 'tags' : 'literatura' + , 'publisher': 'Hernan Racnati' + , 'language' : language + } + + feeds = [(u'Posts', u'http://www.reptantes.com.ar/?feed=rss2')] + + keep_only_tags = [dict(attrs={'id':'content'})] + remove_tags = [dict(attrs={'class':'iLikeThis'})] + remove_tags_before = dict(name='h2') + remove_tags_after = dict(attrs={'class':'iLikeThis'}) + + + def preprocess_html(self, soup): + for item in soup.findAll(style=True): + del item['style'] + return self.adeify_images(soup) + +