Skip to content

Raspberry pi

José Amuedo Salmerón edited this page May 15, 2018 · 6 revisions

How to Install messic on a Raspberry pi

OK, if you are here it means that you want to install messic into a raspberry pi. We recomend install messic only on a raspberry pi 2 or higher. (it works also on a basic raspberry pi b+, but a bit slow). The steps to install messic into your raspberry are very easy, but must be explained:

Download messic from you raspberry pi.

First, go into Downloads folder (for instance, or any other folder where you have permissions)
$ cd /home/pi/Downloads

(by the way, if you doesn't have a Downloads folder, you can create one just $ mkdir /home/pi/Downloads)

And then download messic (this is the url for the .gz linux version -current version 1.1.0- check if this is the last messic version and get the last url)
$ wget https://github.com/spheras/messic/releases/download/v1.1.0/messic-1.1.0.app-linux.tar.gz

Uncompress the downloaded .gz file

$ tar -zxvf messic-1.1.0.app-linux.tar.gz messic-1.1.0.app/

Check your java client

Last raspbian versions don't need to install java. You can check if the oracle JVM is installed typing the following:
$ java -version
If it is installed you will see something similar to:

java version "1.7.0_60"
Java(TM) SE Runtime Environment (build 1.7.0_60-b19)
Java HotSpot(TM) Client VM (build 24.60-b09, mixed mode)

If not, then you'll need to install it manually:
$ sudo apt-get install oracle-java7-jdk

Create messic for raspberry launcher

You'll need an special launcher for messic inside the raspberry pi, because the existent launchers are prepared for a PC environment. It is an easy task. Just create a file with:

$ cd messic-1.1.0.app
$ nano messic.sh

and paste inside the following content:

#
# Copyright (C) 2013
#
#  This file is part of Messic.
# 
#  This program is free software: you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation, either version 3 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

echo "Starting messic for raspberry pi..."

CURRENT_PATH=$(pwd)

cd ./bin

#recreating the messic.desktop each time (due to the need to put absolute path to icon and exe)
if [ -f "../messic.desktop" ]; then
    rm ../messic.desktop
fi
echo "[Desktop Entry]" >> ../messic.desktop
echo "Name=messic" >> ../messic.desktop
echo "Comment=messic" >> ../messic.desktop
echo "Terminal = false" >> ../messic.desktop
echo "Type=Application" >> ../messic.desktop
echo 'Exec=bash -c "cd ' $CURRENT_PATH ' && ./bin/messic.sh"' >> ../messic.desktop
echo "Icon=$CURRENT_PATH/bin/messic-icon.png" >> ../messic.desktop
echo "Categories = Audio;Player;;" >> ../messic.desktop


#concatenate the classpath files, by Casimiro
classpathVar="."
array=($(ls ../classpath))
for i in "${array[@]}"
do
	classpathVar="$classpathVar:./classpath/$i"
done


cd ..
java -cp "$classpathVar" org.messic.starter.Starter $1 $2 $3 $4 $5

Press Ctrl+X and Yes, to Save the file. After that, give it execution permissions:

$ sudo chmod a+x messic.sh

Such way, you now have a launcher to start it manually:

$ ./messic.sh -gui false -java native -start

Getting the messic web page for the first time

If you execute the previous command, messic will start loading (give it some minutes). And, finally, you could get the messic web page from a navigator inside your network, for instance, the following URL:

http://PUT_YOUR_RASPBERRY_IP_HERE:8080/messic

Note: To get your raspberry IP, for instance, get it with an ifconfig commnad.
Note2: Probably messic is waiting at the 8080 port. But you can always confirm the port which is being used by messic viewing the content of the auto generated 'currentport' file.
$ cat ./currentport

Now, stop the service if you want to change the default configuration. Remember to stop the service you can always call the same launcher with the -stop parameter:

$ ./messic.sh -stop

Configuring Messic

The configuration is inside the folder conf/configuration.properties. Probably the only thing you'll need to touch is the messic-musicfolder property. Put there the destination folder where you will store your music (perhaps the path to a connected external USB? If you get a very slow experience opening messic albums, probably you need to modify the usb sync, just go to the last FAQ section to disable sync for usb hd)... Becareful touching there.

Start Automatically

Finally, probably you'll will want to start automatically messic on each reboot.... There are different ways to do this, but probably the easiest one is modifing the /etc/rc.local file.

$ sudo nano /etc/rc.local

The file should be like the following

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

cd /home/pi/Downloads/messic-1.1.0.app/
bash ./messic.sh -gui false -java native -start


# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"
fi

exit 0

After that, you can reboot the raspberry and messic will be launched on every boot.

FAQ

Why is so slow?

My experience with raspberry pi 3 is so good. It is very fast. On the contrary, raspberry pi 2... is OK, but not very good. Sometimes I had a problem with the external USB hard drive connected to the raspberry where the music was stored. It was very slow reading and saving data from that drive. The problem was the usb automount sync parameter. To modify that, just edit the /etc/usbmount/usbmount.conf file and remove the "sync" parameter.