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 \ s3cmd \
portaudio19-dev \ portaudio19-dev \
mpg123 \ mpg123 \
screen \
curl curl
# upgrade virtualenv to latest from pypi # 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) # install requirements (except pocketsphinx)
pip install -r requirements.txt pip install -r requirements.txt
CORES=$(nproc)
echo Building with $CORES cores.
# clone pocketsphinx-python at HEAD (fix to a constant version later) # clone pocketsphinx-python at HEAD (fix to a constant version later)
if [ ! -d ${TOP}/pocketsphinx-python ]; then if [ ! -d ${TOP}/pocketsphinx-python ]; then
# build sphinxbase and pocketsphinx if we haven't already # build sphinxbase and pocketsphinx if we haven't already
@ -54,11 +57,11 @@ if [ ! -d ${TOP}/pocketsphinx-python ]; then
cd ${TOP}/pocketsphinx-python/sphinxbase cd ${TOP}/pocketsphinx-python/sphinxbase
./autogen.sh ./autogen.sh
./configure ./configure
make make -j$CORES
cd ${TOP}/pocketsphinx-python/pocketsphinx cd ${TOP}/pocketsphinx-python/pocketsphinx
./autogen.sh ./autogen.sh
./configure ./configure
make make -j$CORES
fi fi
# build and install pocketsphinx python bindings # build and install pocketsphinx python bindings

View File

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

View File

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

View File

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

View File

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

View File

@ -36,11 +36,24 @@ config = ConfigurationManager.get()
client_config = config.get("messagebus_client") 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): class WebsocketClient(object):
def __init__(self, host=client_config.get("host"), def __init__(self, host=client_config.get("host"),
port=client_config.get("port"), port=client_config.get("port"),
path=client_config.get("route"), 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.emitter = EventEmitter()
self.scheme = "wss" if ssl else "ws" self.scheme = "wss" if ssl else "ws"
self.host = host 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(): def main():
import tornado.options import tornado.options
tornado.options.parse_command_line() tornado.options.parse_command_line()
config = ConfigurationManager.get() config = ConfigurationManager.get()
service_config = config.get("messagebus_service") service_config = config.get("messagebus_service")
route = service_config.get('route')
validate_param(route, 'route')
routes = [ routes = [
(service_config.get('route'), WebsocketEventHandler) (route, WebsocketEventHandler)
] ]
application = web.Application(routes, **settings) 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 = ioloop.IOLoop.instance()
loop.start() loop.start()

View File

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

View File

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