Merge branch 'master' into feature/deb-packaging

pull/227/head
aatchison 2016-06-20 15:45:42 -05:00
commit 8014f95b53
10 changed files with 52 additions and 17 deletions

View File

@ -18,6 +18,7 @@ sudo apt-get install -y \
s3cmd \
portaudio19-dev \
mpg123 \
screen \
curl
# upgrade virtualenv to latest from pypi

View File

@ -47,6 +47,9 @@ easy_install pip==7.1.2 # force version of pip
# install requirements (except pocketsphinx)
pip install -r requirements.txt
CORES=$(nproc)
echo Building with $CORES cores.
# clone pocketsphinx-python at HEAD (fix to a constant version later)
if [ ! -d ${TOP}/pocketsphinx-python ]; then
# build sphinxbase and pocketsphinx if we haven't already
@ -54,11 +57,11 @@ if [ ! -d ${TOP}/pocketsphinx-python ]; then
cd ${TOP}/pocketsphinx-python/sphinxbase
./autogen.sh
./configure
make
make -j$CORES
cd ${TOP}/pocketsphinx-python/pocketsphinx
./autogen.sh
./configure
make
make -j$CORES
fi
# build and install pocketsphinx python bindings

View File

@ -3,18 +3,19 @@
set -Ee
MIMIC_DIR=mimic
CORES=$(nproc)
# download and install mimic
if [ ! -d ${MIMIC_DIR} ]; then
git clone https://github.com/MycroftAI/mimic.git
cd ${MIMIC_DIR}
./configure --with-audio=alsa
make
make -j$CORES
else
# ensure mimic is up to date
cd ${MIMIC_DIR}
git pull
make clean
./configure --with-audio=alsa
make
make -j$CORES
fi

View File

@ -7,6 +7,7 @@ fi
# Setup variables.
CACHE="/tmp/install-pygtk-$$"
CORES=$(nproc)
# Make temp directory.
mkdir -p $CACHE
@ -27,7 +28,7 @@ then
( cd py2cairo*
autoreconf -ivf
./configure --prefix=$VIRTUAL_ENV --disable-dependency-tracking
make
make -j$CORES
make install
)
)
@ -48,7 +49,7 @@ then
tar -xvf pygobject.tar.bz2
( cd pygobject*
./configure --prefix=$VIRTUAL_ENV --disable-introspection
make
make -j$CORES
make install
)
)
@ -69,7 +70,7 @@ then
tar -xvf pygtk.tar.bz2
( cd pygtk*
./configure --prefix=$VIRTUAL_ENV PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$VIRTUAL_ENV/lib/pkgconfig
make
make -j$CORES
make install
)
)

View File

@ -28,6 +28,8 @@ function stop-mycroft {
screen -XS mycroft-voice quit
}
set -e
if [[ -z "$1" || "$1" == "-h" ]]
then
usage

View File

@ -7,7 +7,7 @@ stop_threshold = 2 # in seconds
third_party_skills_dir = "~/.mycroft/third_party_skills"
[messagebus_service]
host = ""
host = "localhost"
port = 8000
route = "/events/ws"

View File

@ -36,11 +36,24 @@ config = ConfigurationManager.get()
client_config = config.get("messagebus_client")
def validate_param(value, name):
if not value:
raise ValueError("Missing or empty %s in mycroft.ini "
"[messagebus_client] section", name)
class WebsocketClient(object):
def __init__(self, host=client_config.get("host"),
port=client_config.get("port"),
path=client_config.get("route"),
ssl=str2bool(client_config.get("ssl"))):
ssl=client_config.get("ssl")):
validate_param(host, "host")
validate_param(port, "port")
validate_param(path, "route")
validate_param(ssl, "ssl")
ssl = str2bool(ssl)
self.emitter = EventEmitter()
self.scheme = "wss" if ssl else "ws"
self.host = host

View File

@ -28,19 +28,32 @@ settings = {
}
def validate_param(value, name):
if not value:
raise ValueError("Missing or empty %s in mycroft.ini "
"[messagebus_service] section", name)
def main():
import tornado.options
tornado.options.parse_command_line()
config = ConfigurationManager.get()
service_config = config.get("messagebus_service")
route = service_config.get('route')
validate_param(route, 'route')
routes = [
(service_config.get('route'), WebsocketEventHandler)
(route, WebsocketEventHandler)
]
application = web.Application(routes, **settings)
host = service_config.get("host")
port = service_config.get("port")
validate_param(host, 'host')
validate_param(port, 'port')
application.listen(service_config.get("port"), service_config.get("host"))
application.listen(port, host)
loop = ioloop.IOLoop.instance()
loop.start()

View File

@ -17,7 +17,6 @@
from os.path import dirname
from os.path import join
from adapt.intent import IntentBuilder
from mycroft.messagebus.message import Message
@ -31,15 +30,14 @@ class NapTimeSkill(MycroftSkill):
super(NapTimeSkill, self).__init__(name="NapTimeSkill")
def initialize(self):
intent_parser = IntentBuilder("NapTimeIntent").require(
self.load_data_files(dirname(__file__))
naptime_intent = IntentBuilder("NapTimeIntent").require(
"SleepCommand").build()
self.register_intent(intent_parser, self.handle_intent)
self.load_vocab_files(join(dirname(__file__), 'vocab', 'en-us'))
self.register_intent(naptime_intent, self.handle_intent)
# TODO - Localization
def handle_intent(self, message):
self.emitter.emit(Message('recognizer_loop:sleep'))
self.speak("Ok, I'm going to sleep.")
self.speak_dialog("sleep")
def stop(self):
pass

View File

@ -0,0 +1,3 @@
i'm going to sleep
going to sleep now
alright, going to sleep