Begin add search module
This commit is contained in:
parent
d753d98637
commit
be1cd97916
7 changed files with 36 additions and 5 deletions
|
@ -4,6 +4,8 @@
|
||||||
- brains/say.yml
|
- brains/say.yml
|
||||||
- brains/systemdate.yml
|
- brains/systemdate.yml
|
||||||
- brains/neurotransmitter.yml
|
- brains/neurotransmitter.yml
|
||||||
|
- brains/kill.yml
|
||||||
|
- brains/search.yml
|
||||||
|
|
||||||
- name: "order-not-found-synapse"
|
- name: "order-not-found-synapse"
|
||||||
signals: []
|
signals: []
|
||||||
|
@ -32,6 +34,6 @@
|
||||||
signals: []
|
signals: []
|
||||||
neurons:
|
neurons:
|
||||||
- say:
|
- say:
|
||||||
message: "je suis prête"
|
message: "je suis prêt"
|
||||||
|
|
||||||
|
|
||||||
|
|
7
brains/kill.yml
Normal file
7
brains/kill.yml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
- name: "stop-kalliope"
|
||||||
|
signals:
|
||||||
|
- order: "stop"
|
||||||
|
neurons:
|
||||||
|
- say:
|
||||||
|
message: "Au revoir"
|
||||||
|
- kill_switch
|
9
brains/search.yml
Normal file
9
brains/search.yml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
- name: "search-fr"
|
||||||
|
signals:
|
||||||
|
- order: "recherche {{ search }}"
|
||||||
|
neurons:
|
||||||
|
- say:
|
||||||
|
message:
|
||||||
|
- "Recherche effectuée"
|
||||||
|
- search:
|
||||||
|
search: "{{search}}"
|
4
resources/neurons/.gitignore
vendored
4
resources/neurons/.gitignore
vendored
|
@ -1,4 +0,0 @@
|
||||||
# Ignore everything in this directory
|
|
||||||
*
|
|
||||||
# Except this file
|
|
||||||
!.gitignore
|
|
1
resources/neurons/search/.gitignore
vendored
Normal file
1
resources/neurons/search/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
__pycache__
|
1
resources/neurons/search/__init__.py
Normal file
1
resources/neurons/search/__init__.py
Normal file
|
@ -0,0 +1 @@
|
||||||
|
from .search import Search
|
15
resources/neurons/search/search.py
Normal file
15
resources/neurons/search/search.py
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
import logging
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
from kalliope.core import NeuronModule
|
||||||
|
from kalliope.core.NeuronModule import MissingParameterException
|
||||||
|
|
||||||
|
class Search(NeuronModule):
|
||||||
|
def __init__(self, **kwargs):
|
||||||
|
super(Search, self).__init__(**kwargs)
|
||||||
|
|
||||||
|
self.query = kwargs.get('search', None)
|
||||||
|
|
||||||
|
if self.query is not None:
|
||||||
|
command = "xdg-open \"https://www.google.fr/search?q="+self.query+"&ie=utf-8&oe=utf-8\" &"
|
||||||
|
p = subprocess.Popen(command, shell=True)
|
Loading…
Reference in a new issue