diff --git a/src/calibre/web/feeds/recipes/collection.py b/src/calibre/web/feeds/recipes/collection.py index 5092e3ee4c..a0803fba57 100644 --- a/src/calibre/web/feeds/recipes/collection.py +++ b/src/calibre/web/feeds/recipes/collection.py @@ -120,7 +120,7 @@ def get_custom_recipe_collection(*args): def update_custom_recipe(id_, title, script): - update_custom_recipes( [(id_, title, script)] ) + update_custom_recipes([(id_, title, script)]) def update_custom_recipes(script_ids): from calibre.web.feeds.recipes import custom_recipes, \ @@ -141,6 +141,9 @@ def update_custom_recipes(script_ids): custom_recipes[id_] = (title, fname) + if not os.path.exists(bdir): + os.makedirs(bdir) + with open(os.path.join(bdir, fname), 'wb') as f: f.write(script) @@ -166,6 +169,9 @@ def add_custom_recipes(script_map): custom_recipes[fid] = (title, fname) + if not os.path.exists(bdir): + os.makedirs(bdir) + with open(os.path.join(bdir, fname), 'wb') as f: f.write(script) id_ += 1 @@ -538,4 +544,3 @@ class SchedulerConfig(object): recipe = {'id':urn, 'title':r['title']} self.schedule_recipe(recipe, typ, schedule, last_downloaded=r['last_downloaded']) -