1
0
Fork 0

Begin add search module

This commit is contained in:
Florian RICHER 2022-04-30 19:22:10 +02:00
parent d753d98637
commit be1cd97916
7 changed files with 36 additions and 5 deletions

View file

@ -4,6 +4,8 @@
- brains/say.yml
- brains/systemdate.yml
- brains/neurotransmitter.yml
- brains/kill.yml
- brains/search.yml
- name: "order-not-found-synapse"
signals: []
@ -32,6 +34,6 @@
signals: []
neurons:
- say:
message: "je suis prête"
message: "je suis prêt"

7
brains/kill.yml Normal file
View file

@ -0,0 +1,7 @@
- name: "stop-kalliope"
signals:
- order: "stop"
neurons:
- say:
message: "Au revoir"
- kill_switch

9
brains/search.yml Normal file
View file

@ -0,0 +1,9 @@
- name: "search-fr"
signals:
- order: "recherche {{ search }}"
neurons:
- say:
message:
- "Recherche effectuée"
- search:
search: "{{search}}"

View file

@ -1,4 +0,0 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

1
resources/neurons/search/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
__pycache__

View file

@ -0,0 +1 @@
from .search import Search

View 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)