diff --git a/src/calibre/utils/opml.py b/src/calibre/utils/opml.py index 12a95cb889..f508d7138c 100644 --- a/src/calibre/utils/opml.py +++ b/src/calibre/utils/opml.py @@ -29,59 +29,3 @@ class OPML(object): outline.set('xmlUrl', feeds) return self.outlines - - def import_recipes(self, outlines): - nr = 0 - #recipe_model = CustomRecipeModel(RecipeModel()) - for outline in outlines: - src, title = self.options_to_profile(dict( - nr=nr, - title=unicode(outline.get('title')), - feeds=outline.get('xmlUrl'), - oldest_article=self.oldest_article, - max_articles=self.max_articles, - base_class='AutomaticNewsRecipe' - )) - try: - compile_recipe(src) - add_custom_recipe(title, src) - except Exception as err: - # error dialog should be placed somewhere where it can have a parent - # Left it here as this way only failing feeds will silently fail - error_dialog(None, _('Invalid input'), - _('

Could not create recipe. Error:
%s')%str(err)).exec_() - nr+=1 - - #recipe_model.add(title, src) - - - def options_to_profile(self, recipe): - classname = 'BasicUserRecipe'+str(recipe.get('nr'))+str(int(time.time())) - title = recipe.get('title').strip() - if not title: - title = classname - oldest_article = self.oldest_article - max_articles = self.max_articles - feeds = recipe.get('feeds') - - src = '''\ -class %(classname)s(%(base_class)s): - title = %(title)s - oldest_article = %(oldest_article)d - max_articles_per_feed = %(max_articles)d - auto_cleanup = True - - feeds = %(feeds)s -'''%dict(classname=classname, title=repr(title), - feeds=repr(feeds), oldest_article=oldest_article, - max_articles=max_articles, - base_class='AutomaticNewsRecipe') - return src, title - -if __name__ == '__main__': - opml = OPML(); - opml.load('/media/sf_Kenny/Downloads/feedly.opml') - outlines = opml.parse() - print(len(opml.outlines)) - opml.import_recipes(outlines) -