Recipe skill for Mycroft_gui

as to this I think you do not write permission to the folder it trying to write to. normally for me it writes these files to mycroft-core and i use that as a slush folder

try this add this line to the bottom of online script found in the bash folder

 pwd > $HOME/tmp.log

it will write the current write directory paths to a file stored in the home folder under the file name tmp.log then you can check if you have write permission to that folder
you can also check who the program username it is trying to write under just add this line under the above

whoami >> $HOME/tmp.log

if it writing as a user that not the current log in user or expected user . it will write the tmp.log to either its home directory and if that does not exist to root directory

So I deleted everything from this skill, and reinstalled it. Seems to work now. Part of it, I did not have the right permissions in the skills folder.

I will do more testing now.

1 Like

Hi i know its been a while since you updated your skill and its really cool. i found some typeos in the github lines 431 i changed to :
fd = os.open(“tmp_recipe”, os.O_RDONLY)
filepath = os.fdopen(fd)
path = filepath.read()

that seems to work and lines 422,683,733,789 i fixed recipes for gui.sh

but i cant seem to get online working.
any hints.
thank you

what happens when you run the bash scripts directly in the terminal

./process_recipe https://www.allrecipes.com/recipe/26016/cranberry-upside-down-coffee-cake/

it should produce something like this

Ingredients
     ⅓ cup butter
     1 ¼ cups cranberries
     ½ cup chopped pecans
     ½ cup butter, room temperature
     ¾ cup white sugar
     2 eggs
     1 teaspoon vanilla extract
     1 cup sour cream
     1 ½ cups all-purpose flour
     1 ½ teaspoons baking powder
     1 teaspoon baking soda
     ½ teaspoon ground cinnamon
     ¼ teaspoon salt

Directions
      a 9 inch springform pan with aluminum foil to prevent leaking. Sift
      together the flour, baking powder, baking soda, cinnamon and salt.
      Set aside.
   2. In a saucepan over medium heat, combine brown sugar and 1/3 cup
      butter. Bring to a boil, then pour into bottom of springform pan.
      Sprinkle with cranberries and pecans.
   3. In a large bowl, cream together the butter and 3/4 cup sugar until
      light and fluffy. Beat in the eggs one at a time, then stir in the
      vanilla. Beat in the flour mixture alternately with the sour cream.
      Pour batter into prepared pan.
   4. Bake in the preheated oven for 60 minutes, or until a toothpick
      inserted into the center of the cake comes out clean. Cool in pan
      for 10 minutes, then invert onto serving platter and carefully
      remove pan. Serve warm.

my recipe skill still appears to be working fine I just grabbed this today with it … some times all recipe webpage page format changes slightly and you have to adjust it to process the change . you can test each script to see if it got broken somewhere . if the scripts work fine then it probably got broken somewhere with the newer python version that you are probably using

oops I see you were refering to the bash script online already okay i tested that one they changed how they called thier search

./online cake cherry

it went from:

https://www.allrecipes.com/search/results/?wt

to

https://www.allrecipes.com/search?q

so change to look like this

#!/bin/bash 

lynx -dump "https://www.allrecipes.com/search?q=$1+$2+$3+$4+$5+$6+$7+$8&sort=re"  |  
grep "https://www.allrecipes.com/recipe/" | 
cut -d"." -f2- |
sed '/^$/d' |
sed '$!N; /^\(.*\)\n\1$/!P; D' > tmp_URL

 cat tmp_URL | tr " "  "\n" |sed $'s/https:\/\/www.allrecipes.com\/recipe/\\\/g' | cut -d/ -f3 | tr "-" " " | sed '/^$/d' | sed -ne 's/$/ .. &/p' |  nl -bt -s ... > tmp_recipe

if you are wondering how I determines their search query format . just enter something in their search bar and press enter - the resulting url tells you how they changed the format . I see generally with all-recipe they change things up slightly every ~2 years. usually the changes are minimal as in the case of this search query format

one more thing they changed is the recipe thumbnail location

so you have to change process_recipe3 as well

 lynx -dump $INPUT | grep "https://imagesvc.meredithcorp.io" | sed 's/https:\/\//\'$'\n/g' | sed '$!d' | sed -ne 's/.*/https:\/\/&/p' > PIC_URL  # process picturelink

to

lynx -source $INPUT | grep 'og:image" content="https://www.allrecipes.com/thmb/' | sed 's/https:\/\//\'$'\n/g' | sed '$!d' | sed -ne 's/.*/https:\/\/&/p' | sed 's/[\"].*//'  > PIC_URL  # process picturelink

okay I found one more change but this has to do with a change in python itself - when it reads a line it added a new line character I had to add

PIC_OL = PIC_OL.strip()

to strip the new line character so it could process the image URL

I also updated github with the new changes… if other issue let me know as currently it working fine on my computer setup

its awesome that you replied. I will continue till this skill works right. now it looks like I have permissions issues. again if nobody has told your awesome today just let it be known. the skill has a lot of components I’m interested in and it would also be nice to have my security screen pop up what I’m cooking in the kitchen with voice command so its useful skill.

well thank you kindly for the praise- much appreciated . that an interesting addition to it…, probably have to make a “add today’s menu” section in init.py sort of loosely based on the “save recipe” . when you find a recipe you like just say add to menu ( possible subsection appetizer, main course …etc) and then a a display menu section

good luck hope it works well for you for you

This skill looks really interesting. Could you tell me how to install it please?

I just got a Mycroft Mark II but because it’s sadly pretty limited, I have also installed mycroft core on my desktop PC.

Follow up question, I keep recipes I like on evernote and they have an API so I was wondering if this skill might work with that.

@postman
simply install lynx on your computer or device.
ie debian based os

sudo apt  install lynx

then just

git clone https://github.com/krywenko/all-recipe-skill.git

in your mycroft skills directory

and it should work

if not let me know what errors you get

@krywenko thanks didn’t realise it was as easy as dropping the skill into the skills directory. It was detected and installed without me doing anything else.

I get some errors when I try to use it. This is mycroft core installed on Ubuntu 22.04 running in a terminal window - for example ‘lemon cake recipe’ the skills log shows …

2022-12-30 10:28:18.660 | INFO | 3183538 | msm.mycroft_skills_manager | Best match (1.0): all-recipe-skill by krywenko
2022-12-30 10:28:18.661 | ERROR | 3183538 | SkillInstallerSkill | MSM failed: AlreadyInstalled(all-recipe-skill)
/bin/sh: 1: skills/all-recipe-skill/./GUI.sh: Permission denied
sh: 1: skills/all-recipes-skill/bash/en-us/./online: not found
2022-12-30 10:30:10.900 | ERROR | 3183538 | mycroft.skills.mycroft_skill.mycroft_skill:on_error:923 | An error occurred while processing a request in All Recipes
Traceback (most recent call last):
File “/home/patrick/mycroft-core/mycroft/skills/mycroft_skill/event_container.py”, line 73, in wrapper
handler(message)
File “/opt/mycroft/skills/all-recipe-skill/init.py”, line 434, in handle_online_getrecipe
filepath = open(“tmp_recipe”,“r”)
FileNotFoundError: [Errno 2] No such file or directory: ‘tmp_recipe’
/bin/sh: 1: skills/all-recipe-skill/./GUI.sh: Permission denied
sh: 1: skills/all-recipes-skill/bash/en-us/./online: not found
2022-12-30 10:30:37.786 | ERROR | 3183538 | mycroft.skills.mycroft_skill.mycroft_skill:on_error:923 | An error occurred while processing a request in All Recipes
Traceback (most recent call last):
File “/home/patrick/mycroft-core/mycroft/skills/mycroft_skill/event_container.py”, line 73, in wrapper
handler(message)
File “/opt/mycroft/skills/all-recipe-skill/init.py”, line 434, in handle_online_getrecipe
filepath = open(“tmp_recipe”,“r”)
FileNotFoundError: [Errno 2] No such file or directory: ‘tmp_recipe’

seams like permissions are denied see if scripts are set as executable .
they are found in the root of all-recipe and in bash/en-us/

and if that does not work try this one from my mycroft skill folder

Here is a better food skill: food wizard refactor - YouTube

Link to skill: GitHub - OpenVoiceOS/food-wizard: Get Popular Food & Cooking Recipes On The Go, Mycroft Recipes Skill

Looking for non dinkum testers