nextcloud / cookbook

🍲 A library for all your recipes
https://apps.nextcloud.com/apps/cookbook
GNU Affero General Public License v3.0
537 stars 93 forks source link

Import from MyCookBook #81

Closed thw26 closed 5 years ago

thw26 commented 5 years ago

The popular site https://mycookbook-online.net, which has apps for mobile devices as well, would be a great source for imports.

Taking a backup (on Android) of MyCookBook's recipes (.mcb, which is a .zip) and extracting the contents yields a my_cookbookDATE.xml file. The contents of that .xml file store recipes in the following format.

<recipe>
<title>Zuppa Toscana Soup like Olive Garden's</title>
<preptime></preptime>
<cooktime></cooktime>
<ingredient><li>1 lb. spicy Italian sausage - crumbled</li>
<li>1/2 lb. smoked bacon - chopped</li>
<li>1 qt. water</li>
<li>(2) 14.5 oz. cans chicken broth</li>
<li>2 lg. russet potatoes - cubed</li>
<li>2 garlic cloves - crushed</li>
<li>1 med. onion - chopped</li>
<li>2 cups chopped kale OR Swiss chard</li>
<li>1 cup heavy whipping cream</li>
<li>salt and pepper - to taste</li>
</ingredient>
<recipetext><li>In a skillet over medium-high heat, brown sausage, breaking into small pieces as you fry it; drain, set aside.</li>
<li>-In a skillet over medium-high heat, brown bacon; drain, set aside.</li>
<li>-Place water, broth, potatoes, garlic, and onion in a pot; simmer over medium heat until potatoes are tender.</li>
<li>-Add sausage and bacon to pot; simmer for 10 minutes.</li>
<li>-Add kale and cream to pot; season with salt and pepper; heat through.</li>
</recipetext>
<url>http://recipes.robbiehaf.com/print5/573.htm</url>
<imagepath>/storage/emulated/0/MyCookBook/images/Zuppa_Toscana_Soup_like_Olive_Gardens_2.png</imagepath>
<imageurl></imageurl>
<quantity>4</quantity>
<rating>0</rating>
<nutrition></nutrition>
<comments><li>Reviews very positive. Might want sausage 1/2 &amp; 1/2 spicy/mild</li>
<li>Can use fat free half and half</li>
<li>Stir in kale only to that which will eat at that time.</li>
</comments>
<category>Soup</category>
</recipe>
<recipe>
<title>Virginia’s Green Beans Provencal</title>
<preptime></preptime>
<cooktime></cooktime>
<ingredient><li>Salt</li>
<li>1 1/2 pounds haricots verts, ends trimmed</li>
<li>1 tablespoon olive oil</li>
<li>1 clove garlic, very finely chopped</li>
<li>2 tomatoes, diced</li>
<li>15 kalamata olives, pitted and halved</li>
<li>2 tablespoons freshly chopped basil leaves</li>
<li>1 tablespoon red wine vinegar</li>
<li>Freshly ground black pepper</li>
</ingredient>
<recipetext><li>Prepare an ice-water bath by filling a large bowl with ice and water</li>
<li></li>
<li>Bring a large pot of salted water to a rolling boil over high heat. Add the beans and cook until crisp-tender, about 2 minutes. Drain well in a colander, then set the colander with beans in the ice-water bath, making sure the beans are submerged. Drain the beans, shaking off the excess water.</li>
<li></li>
<li>In the same pot, heat the oil over low heat. Add beans, garlic, tomatoes, olives and basil, and toss to combine. Drizzle vinegar over beans and toss to coat. Taste and adjust for seasoning with pepper. Serve hot, warm, or cold.</li>
</recipetext>
<url>http://www.pauladeen.com/recipes/recipe_view/virginias_green_beans_provencal/</url>
<imagepath>/storage/emulated/0/MyCookBook/images/Virginias_Green_Beans_Provencal_2.png</imagepath>
<imageurl></imageurl>
<quantity>4</quantity>
<rating>4</rating>
<nutrition></nutrition>
<comments><li>Use grape tomatoes cut in half.</li>
<li>NO salt needed.</li>
</comments>
<source>Paula Deen</source>
<category>Vegetable</category>
</recipe>
<recipe>
<title>Traditional Lasagna</title>
<preptime>30M</preptime>
<cooktime>70M</cooktime>
<ingredient><li>1 pound ground beef</li>
<li>3/4 pound bulk pork sausage</li>
<li>3 cans (8 ounces each) tomato sauce</li>
<li>2 cans (6 ounces each) tomato paste</li>
<li>2 garlic cloves, minced</li>
<li>2 teaspoons sugar</li>
<li>1 teaspoon Italian seasoning</li>
<li>1/2 to 1 teaspoon salt</li>
<li>1/4 to 1/2 teaspoon pepper</li>
<li>3 large eggs</li>
<li>3 tablespoons minced fresh parsley</li>
<li>3 cups (24 ounces) 4% small-curd cottage cheese</li>
<li>1 carton (8 ounces) ricotta cheese</li>
<li>1/2 cup grated Parmesan cheese</li>
<li>9 lasagna noodles, cooked and drained</li>
<li>6 slices provolone cheese (about 6 ounces)</li>
<li>3 cups (12 ounces) shredded part-skim mozzarella cheese, divided</li>
</ingredient>
<recipetext><li>In a large skillet over medium heat, cook and crumble beef and sausage until no longer pink; drain. Add next seven ingredients. Bring to a boil. Reduce heat; simmer, uncovered, 1 hour, stirring occasionally. Adjust seasoning with additional salt and pepper, if desired.</li>
<li>Meanwhile, in a large bowl, lightly beat eggs. Add parsley; stir in cottage cheese, ricotta and Parmesan cheese.</li>
<li>Preheat oven to 375°. Spread 1 cup meat sauce in an ungreased 13x9-in. baking dish. Layer with three noodles, provolone cheese, 2 cups cottage cheese mixture, 1 cup mozzarella, three noodles, 2 cups meat sauce, remaining cottage cheese mixture and 1 cup mozzarella. Top with remaining noodles, meat sauce and mozzarella (dish will be full).</li>
<li>Cover; bake 50 minutes. Uncover; bake until heated through, 20 minutes. Let stand 15 minutes before cutting. Yield: 12 servings.</li>
</recipetext>
<url>http://www.tasteofhome.com/recipes/traditional-lasagna</url>
<imagepath>/storage/emulated/0/MyCookBook/images/Traditional_Lasagna.jpg</imagepath>
<imageurl>http://cdn1.tmbi.com/TOH/Images/Photos/37/300x300/Traditional-Lasagna_EXPS_THND16_12003_C07_26_6b.jpg</imageurl>
<quantity>12 servings</quantity>
<rating>0</rating>
<nutrition>503 calories: 1 piece, 27g fat (13g saturated fat), 136mg cholesterol, 1208mg sodium, 30g carbohydrate (9g sugars, 2g fiber), 36g protein</nutrition>
<comments></comments>
<totaltime>100M</totaltime>
<description></description>
<source></source>
<video></video>
<lang>en</lang>
<category>Beef</category>
<category>Entree</category>
</recipe>
mrzapp commented 5 years ago

@thw26 In terms of which data to use, the best approach would be to just extract the "url" property and then use the import feature in this app to reimport them, since these guys don't seem to care much for the schema.org format that we're using.

The main issue aside from that is that MyCookBook needs to expose an API, and we need to authenticate against that API before we can do any sort of importing. I haven't been able to find any documentation on that, so I don't think that will be easy.

The most reliable approach for now would involve so much manual labour that you might as well just copy the URLs by hand and import them into this app :sweat_smile:

christianlupus commented 5 years ago

Just be sure, what you, @thw26, want: Is your intention to import the recipes from the backup or from the website?

@mrzapp Just importing the backup file could be working. Here is a description to unzip a file using JS. Then the client could parse the XML file as mentioned above and send API requests to the cookbook app to save the individual recipes. What do you think on this approach? I have to admit that JS is not my best side of programming so I would be not of much usage here, sorry.

thw26 commented 5 years ago

The examples I shared were all web resources somewhat intentionally, in case there was desire to obtain the original information. MyCookBook does let one add their own recipes and modify recipes.

The thought was to offer Nextcloud Cookbook as an alternative to MyCookBook, which granted has mobile apps and is in that way ahead of this project.

Importing from a backup file was my thought. Utilizing the URLs would import the recipe but not a user's comments or personal pictures if they had added any to their MyCookBook recipes.

mrzapp commented 5 years ago

All in all, I think this issue, even though it may be a great feature, has 2 major downsides:

I hate to be that guy, but this smells too much like feature creep, so I'm closing the issue for now.