Skip to content

Instantly share code, notes, and snippets.

@rgstephens
Created November 6, 2016 22:11
Show Gist options
  • Save rgstephens/bd76d83510b772bacfa98e7d93746c5b to your computer and use it in GitHub Desktop.
Save rgstephens/bd76d83510b772bacfa98e7d93746c5b to your computer and use it in GitHub Desktop.
Pepperplate Export to Paprika YAML
#!/bin/sh
ids=`sqlite3 ./recipes_2.db <<!
.mode csv
select Id from Recipe;
!`
dumprecipe() {
sqlite3 ./recipes_2.db <<!
.separator ' '
select '- name: ', Title from Recipe where Id = $1;
select ' servings: ', Yield from Recipe where Id = $1;
select ' source: ', Source from Recipe where Id = $1;
select ' description: ', Description from Recipe where Id = $1;
select ' prep_time: ', ActiveTime from Recipe where Id = $1;
select ' cook_time: ', TotalTime from Recipe where Id = $1;
select ' notes: ', Note from Recipe where Id = $1;
!
sqlite3 ./recipes_2.db <<!
.separator ' '
select 'categories: [', Tag.Text, ']' from ItemTag join Tag on Tag.Id = ItemTag.TagId where ItemTag.RecipeId = $1;
!
echo ' ingredients: |'
sqlite3 ./recipes_2.db <<!
.separator ' '
select ' ', IngredientGroup.Title, Ingredient.Quantity, Ingredient.Text from IngredientGroup join Ingredient on Ingredient.GroupId = IngredientGroup.Id where IngredientGroup.RecipeId = $1 order by IngredientGroup.DisplayOrder, Ingredient.DisplayOrder;
!
echo ' directions: |'
sqlite3 ./recipes_2.db <<!
.separator ' '
select ' ', DirectionGroup.Title, Direction.Text from DirectionGroup join Direction on Direction.GroupId = DirectionGroup.Id where DirectionGroup.RecipeId = $1 order by DirectionGroup.DisplayOrder, Direction.DisplayOrder;
!
}
#for id in $ids
for id in 483 1 435
do
dumprecipe $id
echo
done
@wsryno
Copy link

wsryno commented Nov 5, 2019

I tried importing from Pepperplate into recipesage.com and it appears to have worked quite well. I have not had time yet to try recipesage but I look forward to seeing if it suits my needs.

@julianpoy
Copy link

julianpoy commented Jan 23, 2020

I've updated the RecipeSage import tool after some feedback from users. It's a bit faster and more reliable now.

Also, just an FYI - RecipeSage supports export, so even if you're not looking to use RecipeSage long term, you can use it to transform your recipes into text, JSON, or XML.

Link: https://recipesage.com

@jlfwong
Copy link

jlfwong commented Jan 23, 2020

For anyone else using this and seeing the export contain only 3 recipes, it's because of the following lines:

#for id in $ids
for id in 483 1 435

If you change this to just:

for id in $ids

then all recipes will be exported. The version with the "483 1 435" was presumably there for debugging to avoid dumping too much data at once. (Sorry if this is stated elsewhere in the thread -- I didn't see it)

@ProfEiz
Copy link

ProfEiz commented Sep 28, 2020

For anyone looking, please note that at least as of late September 2020, Paprika now directly imports Pepperplate's text file export that Pepperplate will allow you to do for free if you don't pay their extortionate rate to continue using their service. Everyone should be incredibly thankful for people like rgstephens writing code to help before the developers get their act together -- I certainly am, but at this point, no reason to muck with any of this, simply go to Pepperplate.com, export your recipes as a .zip file, and import that .zip file directly into Paprika.
Once again, thank you to the developer for providing this option prior to the development team.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment