Skip to content

Installation

salendron edited this page Feb 8, 2013 · 16 revisions

Setup Rapsberry Pi

First of all you have to set up Raspbian on your Raspberry Pi and you have to able to connect to it using SSH. How that works is best described in this Raspberry Pi getting started guide -> Raspberry Pi getting started guide

Installing dependencies

First we need to install some packages which are needed to run Snakeberry. To install these packages connect to your Raspberry Pi via SSH and execute these commands.

sudo apt-get update

sudo apt-get install python-simplejson

sudo apt-get install python-tornado

sudo apt-get install alsa-utils

sudo apt-get install mplayer

Setting the audio output to analog

You can skip this section if you want to use HDMI audio.

sudo modprobe snd_bcm2835

amixer cset numid=3 1

If volume control does not work, try this:

sudo amixer cset numid=2 1

Install Snakeberry Service

Connect to your Raspberry as user Pi and create a directory in your user home.

mkdir /home/pi/snakeberry

Now download the latest stable release of Snakeberry and extract all files (without another subdirectory) to this directory on your Raspberry. The latest stable release of Snkaberry can be downloaded using this link -> SnakeberryService.zip

Now we also need another directory for logs.

mkdir /home/pi/snakeberry/logs

To make the service start automatically you create a start script in /home/pi/snakeberry and it has to be named startSnakeberry.sh and contain the follwing two lines:

#!/bin/bash

python /home/pi/snakeberry/snakeberry.py

Now we have to make this scrip executable.

chmod +x startSnakeberry.sh

To start this script when the Raspberry Pi starts we need to edit /etc/rc.local.

sudo vi /etc/rc.local

Add the following lines before "exit 0" to the file. It is really important that "exit 0" stays the last line in this file.

date="$(date +'%Y%m%d')"

nohup /home/pi/snakeberry/startSnakeberry.sh >/home/pi/snakeberry/logs/snakeberry_${date}.log 2>&1 &

Configure Radio stations

The last thing we have to do is to configure which radio stations we want to listen to. To do this we have to edit the /home/pi/snakeberry/radio.csv file.

vi /home/pi/snakeberry/radio.csv

In this file ever line represents a radio station consisting of a name and a stream url.

NAME;URL

If you do not know the url of your favourit radio stations you could simply google them. I used for example this list to add some stations.

Radio Stream List

Reboot and connect

Now we need to reboot the system. You could do this by executing the following command:

sudo shutdown -r now

To test if everything worked you could simplay open a browser on a PC in the same network and navigate to the following address.

http://your-raspberry-pi's-IP:8888/

If you get a response similar to this, everything is fine.

{"ErrorCode": 0, "ResponseData": {"Services": [{"DisplayName": "Radio", "BaseUrl": "/radio"}]}, "ErrorMessage": ""}

Now you just have to attach some speakers to the Raspberry and install the Snakeberry Android Remote. See the Remote control section for more information about how to control Snakeberry.

Clone this wiki locally