A simple python script to transform a JSON file full of recipes into a broccoli-archive file that can be loaded into the Android recipe app Broccoli.
The only content in recipes.json is Broccoli's demo recipe for hummus, and I've updated the script from a previous version to use a flatter JSON schema to match what the Broccoli app exports. The list of recipes is a JSON object, with each recipe's title serving as the key for that recipe's object. This might be a bad idea.
Currently, broccolify.py finds recipe images in /img by looking for fileName.jpg, where fileName is generated by stripping punctuation out of the recipe's title and replacing spaces with underscores. Once I figure out how, I'd like it to be more extension-agnostic.
It's best to clear out your recipes before importing a broccoli-archive generated by this script, as otherwise you will end up with lots of duplicate recipes. To do so, navigate to Broccoli's App info via Android's list of apps or by long pressing on the icon and selecting App info. Then tap on "Storage & cache" and "Clear storage". This will delete all of your recipes.
In Broccoli, you can then tap the menu, "Backup and restore", and then "Restore recipes" by selected the broccoli-archive file generated by this script.
A second simple python script which takes a broccoli-archive file and unravels it into a single json file and directory of images (/img). At present the script just grabs a .broccoli-archive file from the current directory and, in the case where there are multiple, will go with whichever glob decides is the first.
Any existing files will be overwritten, though I hope to continue working to develop a more user-friendly "syncing" functionality.