diff --git a/src/calibre/gui2/dialogs/scheduler.py b/src/calibre/gui2/dialogs/scheduler.py index 410b81c714..d220cbadcc 100644 --- a/src/calibre/gui2/dialogs/scheduler.py +++ b/src/calibre/gui2/dialogs/scheduler.py @@ -34,6 +34,9 @@ class Recipe(object): self.downloading = False self.builtin = builtin self.schedule = None + self.author = getattr(recipe_class, '__author__', _('Unknown')) + if self.author == _('Unknown') and not builtin: + self.author = _('You') self.needs_subscription = getattr(recipe_class, 'needs_subscription', False) def pickle(self): @@ -269,6 +272,7 @@ class SchedulerDialog(QDialog, Ui_Dialog): recipe = self._model.data(index, Qt.UserRole) self.current_recipe = recipe self.title.setText(recipe.title) + self.author.setText(_('Created by: ') + recipe.author) self.description.setText(recipe.description if recipe.description else '') self.schedule.setChecked(recipe.schedule is not None) self.interval.setValue(recipe.schedule if recipe.schedule is not None else 1) diff --git a/src/calibre/gui2/dialogs/scheduler.ui b/src/calibre/gui2/dialogs/scheduler.ui index e4084cfee7..e265915f47 100644 --- a/src/calibre/gui2/dialogs/scheduler.ui +++ b/src/calibre/gui2/dialogs/scheduler.ui @@ -80,6 +80,13 @@ + + + + author + + + diff --git a/src/calibre/web/feeds/recipes/__init__.py b/src/calibre/web/feeds/recipes/__init__.py index a18d42e817..224a707239 100644 --- a/src/calibre/web/feeds/recipes/__init__.py +++ b/src/calibre/web/feeds/recipes/__init__.py @@ -16,7 +16,7 @@ recipe_modules = [ 'jpost', 'jutarnji', 'nasa', 'reuters', 'spiegelde', 'wash_post', 'zeitde', 'blic', 'novosti', 'danas', 'vreme', 'times_online', 'the_scotsman', 'nytimes_sub', 'security_watch', 'cyberpresse', 'st_petersburg_times', - 'clarin', + 'clarin', 'financial_times' ] import re, imp, inspect, time, os diff --git a/src/calibre/web/feeds/recipes/financial_times.py b/src/calibre/web/feeds/recipes/financial_times.py new file mode 100644 index 0000000000..5bf21d20fe --- /dev/null +++ b/src/calibre/web/feeds/recipes/financial_times.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python + +__license__ = 'GPL v3' +__copyright__ = '2008, Darko Miletic ' +''' +ft.com +''' + +from calibre.web.feeds.news import BasicNewsRecipe + +class FinancialTimes(BasicNewsRecipe): + title = u'Financial Times' + __author__ = 'Darko Miletic' + description = 'Financial world news' + oldest_article = 2 + max_articles_per_feed = 100 + no_stylesheets = True + use_embedded_content = False + needs_subscription = True + simultaneous_downloads= 1 + delay = 1 + LOGIN = 'https://registration.ft.com/registration/barrier/login' + + def get_browser(self): + br = BasicNewsRecipe.get_browser() + if self.username is not None and self.password is not None: + br.open(self.LOGIN) + br.select_form(name='loginForm') + br['username'] = self.username + br['password'] = self.password + br.submit() + return br + + keep_only_tags = [ dict(name='div', attrs={'id':'cont'}) ] + remove_tags_after = dict(name='p', attrs={'class':'copyright'}) + remove_tags = [ + dict(name='div', attrs={'id':'floating-con'}) + ] + + feeds = [ + (u'UK' , u'http://www.ft.com/rss/home/uk' ) + ,(u'US' , u'http://www.ft.com/rss/home/us' ) + ,(u'Asia' , u'http://www.ft.com/rss/home/asia' ) + ,(u'Middle East', u'http://www.ft.com/rss/home/middleeast') + ] + + def preprocess_html(self, soup): + content_type = soup.find('meta', {'http-equiv':'Content-Type'}) + if content_type: + content_type['content'] = 'text/html; charset=utf-8' + return soup \ No newline at end of file