def recipe_interface(): with sqlite3.connect('db/food.db') as c: while True: #start by getting the url for the recipe url = raw_input('What recipe would you like to work on today?\n') if(url.find("allrecipes.com/") == -1): print("Please put in a url from allrecipes.com") continue else: #print out the original recipe raw_recipe = download.download_recipe(url) recipe = Recipe.parse(c, raw_recipe) print('\nHere is the original recipe:\n') print(recipe.pretty()) # Then ask what transformation to do while True: print('What would you like to do with your recipe?') print('1 = Make Vegetarian') print('2 = Make NOT Vegetarian') print('3 = Change cuisine style') print('4 = Make healthy') x = raw_input() if x in trans_choices.keys(): new_recipe = trans_choices[x](recipe) break else: print('Please pick a number corresponding to one of the available options') print("Here's your new recipe!") print(new_recipe.pretty())
def main(): with open('chili.pkl') as f: with sqlite3.connect('db/food.db') as db: raw_recipe = pkl.load(f) recipe = Recipe.parse(db, raw_recipe) for d in recipe.directions: print d.tagged print 'NEXT\n' veg = recipe.veggitize() for d in veg.directions: print d.tagged print veg.pretty()