actually execute script

This commit is contained in:
Rudis Muiznieks 2022-02-08 16:07:42 -06:00
parent 71c38516ac
commit f20f412e50
Signed by: rudism
GPG key ID: CABF2F86EF7884F9

View file

@ -1,4 +1,5 @@
import os
import thread
from mycroft import MycroftSkill, intent_handler
class RunScriptSkill(MycroftSkill):
@ -26,9 +27,11 @@ class RunScriptSkill(MycroftSkill):
@intent_handler('RunScript.intent')
def handle_run_script_intent(self, msg=None):
script = msg.data.get('script', None)
if script in self.scripts:
script = msg.data.get('script', None).replace(" ", "-")
script_path = os.path.join(self.script_dir, script)
if script in self.scripts and os.path.isfile(script_path):
self.speak_dialog('Running', {'script': script})
thread.start_new_thread(os.system, (script_path))
else:
self.speak_dialog('NotFound', {'script': script})