Skip to content

Instantly share code, notes, and snippets.

@jlyon
Last active November 17, 2017 20:13
Show Gist options
  • Save jlyon/045a931494ee3b8f0e2d8895bd06251e to your computer and use it in GitHub Desktop.
Save jlyon/045a931494ee3b8f0e2d8895bd06251e to your computer and use it in GitHub Desktop.
pi3
sudo apt-get install -y git
# Install nodejs
# From https://raspberrypi.stackexchange.com/questions/48303/install-nodejs-for-all-raspberry-pi
sudo bash
sudo wget -O - https://raw.githubusercontent.com/audstanley/NodeJs-Raspberry-Pi/master/Install-Node.sh | bash
exit
node -v
npm install -g pm2
# pm2 usage: https://stackoverflow.com/a/40254977
# Install go (get latest)
wget https://storage.googleapis.com/golang/go1.9.linux-armv6l.tar.gz
sudo tar -C /usr/local -xzf go1.9.linux-armv6l.tar.gz
echo "export PATH=$PATH:/usr/local/go/bin:/opt/nodejs/bin" >> ~/.profile
source ~/.profile
# Install packages
sudo apt-get update
sudo apt-get install -y git python-pip omxplayer
sudo raspi-config
# Configure MemorySetup > `128 384Mb for ARM, 128Mb for VideoCore`
sudo reboot
# Clone and install slack-audiobot
cd ~/
git clone https://github.com/jlyon/slack-audiobot.git
cd slack-audiobot
npm config set python /path/to/python2.7
sudo npm install
# edit config/config.js with bot token from https://shoppad.slack.com/apps/A0F7YS25R-bots?page=1
# Run as service
# From https://www.digitalocean.com/community/tutorials/how-to-use-pm2-to-setup-a-node-js-production-environment-on-an-ubuntu-vps
# And for Pi: https://github.com/Unitech/pm2/issues/1654#issuecomment-267798825
sudo /opt/nodejs/bin/pm2 start audiobot.js
sudo env PATH=$PATH:/usr/local/bin pm2 startup systemd -u pi --hp /home/pi
# To set volume: `alsamixer scontrols`
# Get musicbot (mopidy to slack)
# https://github.com/sosedoff/musicbot
cd ~/
go get github.com/sosedoff/musicbot
# run with
source ~/musicbot.sh
/home/pi/go/bin/musicbot --mopidy=$MOPIDY_HOST --slack-token=$SLACK_TOKEN --slack-channel=$SLACK_CHANNEL & > /dev/null &
# Add Iris mopidy client
# https://github.com/jaedb/Iris/
# Requires mopidy update https://github.com/pimusicbox/pimusicbox/issues/403
sudo apt-get install gstreamer1.0
pip install mopidy --upgrade
sudo pip install Mopidy-Iris
# Exporting HDD image
# https://computers.tutsplus.com/articles/how-to-clone-raspberry-pi-sd-cards-using-the-command-line-in-os-x--mac-59911
# General instructions: https://docs.mopidy.com/en/latest/installation/raspberrypi/
# raspi-config to set set keyboard, locale, hostname, enable ssh, resize disk
# Set up wifi: https://www.lifewire.com/usb-wifi-adapter-raspberry-pi-4058093
# Install mopidy (from https://github.com/jaedb/Iris/wiki/Getting-started#installing):
wget -q -O - https://apt.mopidy.com/mopidy.gpg | sudo apt-key add -
sudo wget -q -O /etc/apt/sources.list.d/mopidy.list https://apt.mopidy.com/jessie.list
sudo apt-get update
sudo apt-get install mopidy python3-pip build-essential
sudo apt-get install mopidy-spotify mopidy-tunein mopidy-soundcloud mopidy-alsamixer mopidy-local-sqlite
sudo pip install Mopidy-Iris mopidy-scrobbler --upgrade
# sudo pip install mopidy-youtube
#sudo apt-get install gstreamer1.0-plugins-bad # for mopidy-youtube
# Copy config into mopidy.conf
sudo nano /etc/mopidy/mopidy.conf
# or
scp mopidy.conf [email protected]:~/mopidy.conf
ssh [email protected]
sudo mv ~/mopidy.conf /etc/mopidy/mopidy.conf -f
sudo dpkg-reconfigure mopidy
sudo reboot
# Run mopidy as a service: https://docs.mopidy.com/en/latest/service/#service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment