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
<
https://supervegan.neocities.org/posts/mealmaster/>
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)
<
http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/repositories/
1.3/net/curl/7_77_0.zip>
Gawk (DJGPP) (32-bit)
<
http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/devel/awk/gawk/
gwk500b.zip>
json2tsv (16-bit)
<
gopher://tilde.pink/9/~bencollver/files/dos/util/json2tsv/
json2tsv-20230525b.zip>
jsontomm.awk
<
gopher://tilde.pink/0/~bencollver/files/dos/app/mealmaster/json2mm/
jsontomm.awk>
Meal-Master
<
gopher://tilde.pink/9/~bencollver/files/dos/app/mealmaster/mm806F.exe>
Meal-Master Buster
<
gopher://tilde.pink/9/~bencollver/files/dos/app/mealmaster/bustr20n.zip>
I unzipped all of the tools and made sure they were in my path.
Select a recipe to import:
Tofu Peanut Stir-Fry
<
https://www.bbc.co.uk/food/recipes/tofu_peanut_stir-fry_62729>
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 <CONTROL-BREAK> 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 <RETURN> 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 <RETURN> to continue (or <CONTROL-X> 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
[email protected]
Load the resulting MMF file into Meal-Master:
mm
Meal-Master Splash Screen
<
gopher://tilde.pink/I/~bencollver/log/
2024-03-02-json-ld-to-mealmaster/mm1.png>
Press any key to dismiss the splash screen and enter the Main Menu.
Meal-Master Main Menu
<
gopher://tilde.pink/I/~bencollver/log/
2024-03-02-json-ld-to-mealmaster/mm2.png>
Press U to enter Utilities Menu.
Meal-Master Utilities Menu
<
gopher://tilde.pink/I/~bencollver/log/
2024-03-02-json-ld-to-mealmaster/mm3.png>
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
<
gopher://tilde.pink/I/~bencollver/log/
2024-03-02-json-ld-to-mealmaster/mm4.png>
Press S to begin importing recipe.
Meal-Master Import Recipe Screen
<
gopher://tilde.pink/I/~bencollver/log/
2024-03-02-json-ld-to-mealmaster/mm5.png>
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
<
gopher://tilde.pink/I/~bencollver/log/
2024-03-02-json-ld-to-mealmaster/mm6.png>
Press S to search with the specified critera.
Meal-Master Search Results Screen
<
gopher://tilde.pink/I/~bencollver/log/
2024-03-02-json-ld-to-mealmaster/mm7.png>
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
<
gopher://tilde.pink/I/~bencollver/log/
2024-03-02-json-ld-to-mealmaster/mm8.png>
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
<
gopher://tilde.pink/0/~bencollver/log/
2024-03-02-json-ld-to-mealmaster/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
<
gopher://tilde.pink/1/~bencollver/log/2022-12-24-print-quest-part2/>
tags: bencollver,retrocomputing,technical
Tags
====
bencollver
<
gopher://tilde.pink/1/~bencollver/log/tag/bencollver/>
retrocomputing
<
gopher://tilde.pink/1/~bencollver/log/tag/retrocomputing/>
technical
<
gopher://tilde.pink/1/~bencollver/log/tag/technical/>