2024-03-02 - JSON-LD to MealMaster ================================== Someone sent me a link to a blog post about MOAR, a gopher accessible recipe search that i worked on. Part of this post caught my attention: > While I was reading I discovered that a lot of modern recipe > websites include some structured data in the document head in the > form of JSON-LD (which is JSON with Linked Data). And consequently, > a lot of modern recipe software can import recipes directly from > the web if you provide it with a URL for a document that has that > kind of data. Supervegan blog post Challenge accepted! I resolved to create a semi-automated process to import recipes from the web into Meal-Master. First, the toolset: Curl (FreeDOS) (32-bit) Gawk (DJGPP) (32-bit) json2tsv (16-bit) jsontomm.awk Meal-Master Meal-Master Buster I unzipped all of the tools and made sure they were in my path. Select a recipe to import: Tofu Peanut Stir-Fry Download the document: C:\>curl --insecure -o stirfry.htm https://www.bbc.co.uk/food/ recipes/tofu_peanut_stir-fry_62729 Convert to stirfry.txt: C:\>gawk -f jsontomm.awk stirfry.htm stirfry This process is SEMI-automated. Correct stirfry.txt as desired. Convert to stirfry.mmf C:\>mm_bustr MealMaster Buster Version 2.0n Press to abort this program! Volume in drive C is FREEDOS2022 Volume Serial Number is 6969-6969 File not found. Enter filename to convert: stirfry.txt Enter any line you want to appear in each recipe below. (such as where the recipes were found, etc.) (Hit to leave blank and include no posting info) Recipe FROM: https://www.bbc.co.uk/food/recipes/ tofu_peanut_stir-fry_62729 Converted Recipe: Tofu Peanut Vegan Stir-Fry Unformatted Recipes Converted Total of 1 MealMaster Recipes in file STIRFRY.MMF Press to continue (or to end program) At this point, press Ctrl-X or else Meal-Master Buster will delete stirfry.mmf, yanking the tablecloth out from under you. MealMaster Recipe Buster [Version 2.0n] (c) 1996-99, Glen G. Hosey Report any problems/suggestions to hosey@erols.com Load the resulting MMF file into Meal-Master: mm Meal-Master Splash Screen Press any key to dismiss the splash screen and enter the Main Menu. Meal-Master Main Menu Press U to enter Utilities Menu. Meal-Master Utilities Menu Press I to open Import Recipe Screen. Enter filename and press return, or filepath and F1 for list Last File Imported: RECIPE6.MMF Import From File: Type STIRFRY.MMF and press Enter to open Recipe Import Menu. Meal-Master Recipe Import Menu Press S to begin importing recipe. Meal-Master Import Recipe Screen The Import Recipe Screen reports that 1 recipe was found and imported. Press any key to dismiss Import Recipe Screen and return to the Utilities Menu. Press X to return to the Main Menu Press S to open the Search Menu Press T to search by Title Type: Tofu Peanut Vegan Press Enter Meal-Master Search Menu Press S to search with the specified critera. Meal-Master Search Results Screen Because there is only one result, it is selected by default. Otherwise, one can use the arrow keys to select the desired recipe. Press E to export the selected recipe Press Enter 3 times to accept the defaults Meal-Master Recipe Export Screen Press Enter for the 4th time to export TRANSFER.TXT Press X to return to the Search Menu Press X to return to the Main Menu Press Q to quit Meal-Master Press Y to confirm that you wish to quit Meal-Master TRANSFER.TXT The file TRANSFER.TXT will be in Meal-Master v8.06 format. This can be shared anywhere that accepts plain text messages, and imported into any Meal-Master compatible recipe manager. See also my post about how to pretty-print Meal-Master recipes to PDF in DOS. Print Quest Part 2 tags: bencollver,retrocomputing,technical Tags ==== bencollver retrocomputing technical