浏览代码

first commit

nico 8 年之前
当前提交
f8a0773e3a
共有 5 个文件被更改,包括 135 次插入0 次删除
  1. 89 0
      .gitignore
  2. 25 0
      brain.yml
  3. 10 0
      lib/Neurone.py
  4. 1 0
      lib/__init__.py
  5. 10 0
      plugins/system_date/system_date.py

+ 89 - 0
.gitignore

@@ -0,0 +1,89 @@
+# Created by .ignore support plugin (hsz.mobi)
+### Python template
+# Byte-compiled / optimized / DLL files
+__pycache__/
+*.py[cod]
+*$py.class
+
+# C extensions
+*.so
+
+# Distribution / packaging
+.Python
+env/
+build/
+develop-eggs/
+dist/
+downloads/
+eggs/
+.eggs/
+parts/
+sdist/
+var/
+*.egg-info/
+.installed.cfg
+*.egg
+
+# PyInstaller
+#  Usually these files are written by a python script from a template
+#  before PyInstaller builds the exe, so as to inject date/other infos into it.
+*.manifest
+*.spec
+
+# Installer logs
+pip-log.txt
+pip-delete-this-directory.txt
+
+# Unit test / coverage reports
+htmlcov/
+.tox/
+.coverage
+.coverage.*
+.cache
+nosetests.xml
+coverage.xml
+*,cover
+.hypothesis/
+
+# Translations
+*.mo
+*.pot
+
+# Django stuff:
+*.log
+local_settings.py
+
+# Flask stuff:
+instance/
+.webassets-cache
+
+# Scrapy stuff:
+.scrapy
+
+# Sphinx documentation
+docs/_build/
+
+# PyBuilder
+target/
+
+# IPython Notebook
+.ipynb_checkpoints
+
+# pyenv
+.python-version
+
+# celery beat schedule file
+celerybeat-schedule
+
+# dotenv
+.env
+
+# virtualenv
+venv/
+ENV/
+
+# Spyder project settings
+.spyderproject
+
+# Rope project settings
+.ropeproject

+ 25 - 0
brain.yml

@@ -0,0 +1,25 @@
+---
+  - name: "Say hello"
+    neurons:
+      say: "Hello sir"
+    when:
+      - order: "Say hello"
+
+  - name: "Run a simple script"
+    neurons:
+      - script: /some/local/script.sh --some-arguments 1234
+      - say: "Script launched sir"
+    when:
+      - order: "Run script"
+
+  - name: "Say local date"
+    neurons:
+      - system_date
+    when:
+      - order: "What time is it?"
+    register: date_result
+
+  - name: "Run when date"
+    neurons:
+      - say: "It is late, sir?"
+    when: date_result

+ 10 - 0
lib/Neurone.py

@@ -0,0 +1,10 @@
+
+class Neurone:
+    def __init__(self):
+        # Here we load the stt and tts from settings
+        self.stt = "snowboy"
+        self.tts = ""
+
+    def say(self, message):
+        # here we use the tts to make jarvis talk
+        pass

+ 1 - 0
lib/__init__.py

@@ -0,0 +1 @@
+from Neurone import Neurone

+ 10 - 0
plugins/system_date/system_date.py

@@ -0,0 +1,10 @@
+#!/usr/bin/python
+import time
+from lib import Neurone
+
+
+class SystemDate(Neurone):
+    def __init__(self):
+        Neurone.__init__(self)
+        date_now = time.strftime("%H:%M")
+        self.say(date_now)