def get_custom_recipe_collection(*args): from calibre.web.feeds.recipes import compile_recipe, \ custom_recipes bdir = os.path.dirname(custom_recipes.file_path) rmap = {} for id_, x in custom_recipes.iteritems(): title, fname = x recipe = os.path.join(bdir, fname) try: recipe = open(recipe, 'rb').read().decode('utf-8') recipe_class = compile_recipe(recipe) if recipe_class is not None: rmap['custom:%s' % id_] = recipe_class except: print 'Failed to load recipe from: %r' % fname import traceback traceback.print_exc() continue return etree.fromstring(serialize_collection(rmap))
def get_custom_recipe_collection(*args): from calibre.web.feeds.recipes import compile_recipe, \ custom_recipes bdir = os.path.dirname(custom_recipes.file_path) rmap = {} for id_, x in custom_recipes.iteritems(): title, fname = x recipe = os.path.join(bdir, fname) try: recipe = open(recipe, 'rb').read().decode('utf-8') recipe_class = compile_recipe(recipe) if recipe_class is not None: rmap['custom:%s'%id_] = recipe_class except: print 'Failed to load recipe from: %r'%fname import traceback traceback.print_exc() continue return etree.fromstring(serialize_collection(rmap))