actually execute script
This commit is contained in:
parent
71c38516ac
commit
f20f412e50
|
@ -1,4 +1,5 @@
|
||||||
import os
|
import os
|
||||||
|
import thread
|
||||||
from mycroft import MycroftSkill, intent_handler
|
from mycroft import MycroftSkill, intent_handler
|
||||||
|
|
||||||
class RunScriptSkill(MycroftSkill):
|
class RunScriptSkill(MycroftSkill):
|
||||||
|
@ -26,9 +27,11 @@ class RunScriptSkill(MycroftSkill):
|
||||||
|
|
||||||
@intent_handler('RunScript.intent')
|
@intent_handler('RunScript.intent')
|
||||||
def handle_run_script_intent(self, msg=None):
|
def handle_run_script_intent(self, msg=None):
|
||||||
script = msg.data.get('script', None)
|
script = msg.data.get('script', None).replace(" ", "-")
|
||||||
if script in self.scripts:
|
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})
|
self.speak_dialog('Running', {'script': script})
|
||||||
|
thread.start_new_thread(os.system, (script_path))
|
||||||
else:
|
else:
|
||||||
self.speak_dialog('NotFound', {'script': script})
|
self.speak_dialog('NotFound', {'script': script})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue