forked from lasryaric/cherry
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcambridge.sh
More file actions
executable file
·128 lines (112 loc) · 3.02 KB
/
cambridge.sh
File metadata and controls
executable file
·128 lines (112 loc) · 3.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#!/bin/bash
# Cambridge
#
# This script should get Wit.ai's office system up and running on a new Raspberry Pi.
# It takes ~20min to run and you will need to configure a few settings (spotify username, etc.)
#
# Hardware:
# - 1 Raspberry Pi with a microphone and speakers
# - 1 Philips Hue
# - Wit
# - HipChat
# - a Spotify premium account
#
# Before that:
# - install Raspbian
# - force audio output to jack 3.5mm
# - configure wifi, e.g. in /etc/wpa_supplicant/wpa_supplicant.conf:
# ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
# update_config=1
#
# network={
# ssid="myssid"
# psk="mypwd"
# proto=RSN
# key_mgmt=WPA-PSK
# pairwise=CCMP
# auth_alg=OPEN
# }
#
# wit instance: oliviervaussy/Wit%20Office
set -e -x
TMP=~/tmp_cambridge
CHERRY_CONFIG=$TMP/config.json
mkdir -p $TMP
cd $TMP
# install required packages
apt-get update
apt-get -y install git curl cmake libao-dev libdbus-glib-1-dev libsox-dev \
libjson-glib-dev libnotify-dev libsoup2.4-dev
# install libspotify for spop
SPOTIFY=libspotify-12.1.103-Linux-armv6-bcm2708hardfp-release
curl -L -O "https://developer.spotify.com/download/libspotify/$SPOTIFY.tar.gz"
tar xzvf $SPOTIFY.tar.gz
cd $SPOTIFY
make install
cd -
# install spop
SPOP_CONFIG=~/.config/spop/spopd.conf
mkdir -p ~/.config/spop
curl -L -o $SPOP_CONFIG https://raw.githubusercontent.com/Schnouki/spop/master/spopd.conf.sample
if [ -d ./spop ]; then
cd spop
git pull
else
git clone https://github.com/Schnouki/spop.git
cd spop
fi
./build_and_run
cd -
# install node.js
NODE=node_latest_armhf.deb
curl -L -O http://node-arm.herokuapp.com/$NODE
dpkg -i $NODE
# install cherry and its plugins
chown -R $SUDO_USER /usr/local
su $SUDO_USER -c 'npm install -g cherry-core cherry-spotify cherry-wit cherry-hue cherry-gpio'
curl -L -o $(dirname $CHERRY_CONFIG)/cambridge.coffee \
https://raw.githubusercontent.com/wit-ai/cherry/master/contrib/cambridge.coffee
# install witd
curl -L -o witd -spotifyhttps://github.com/wit-ai/witd/raw/master/witd-arm
cat > $CHERRY_CONFIG <<EOF
{
"port": 4433,
"witd_url": "http://localhost:9877",
"wit_token": "MY_WIT_TOKEN",
"hipchat_jid": "38802_1058254@chat.hipchat.com",
"hipchat_pwd": "my_hipchat_pw",
"hipchat_room": "38802_witmusic@conf.hipchat.com/Electric Cherry",
"hue_host": "http://192.168.1.169",
"hue_user": "my_hue_user",
"spop_ip": "192.168.1.68",
"spop_port": 6602,
"tts": {
"host": "mac_ip",
"port": 1334
},
"gpio_pins": {
"22": ["in", "both"]
},
"demo_port": 5576,
"unused": [
"cherry.integration.myo",
"./examples/light_switch.js"
],
"plugins": [
"cherry-spotify",
"cherry.integration.hipchat",
"cherry.integration.wit",
"cherry.integration.hue",
"cherry.integration.gpio",
"cherry.integration.demo_home",
"./cambridge.coffee"
]
}
EOF
set +x
echo "Yay, almost done! You still need to:"
echo "- edit spop config: $SPOP_CONFIG"
echo "- edit cherry config: $CHERRY_CONFIG"
echo "- run witd and spop"
echo ""
echo "You can then run: cherry $CHERRY_CONFIG"