Setup MediaPlayer on ArchLinux (Raspberry Pi/cubox-i)

Since I am using ArchLinux this installation instruction covers this distribution.

Setup ArchLinux

[Downloads]$ sudo dd bs=1M if=ArchLinuxARM-2014.03-rpi.img of=/dev/mmcblk0

see or for additional hints

ssh root@alarmpi

Setup Java

If you do not like to use the fullscreen display, the package jre7-openjdk-headless is enough ;-)

[root@alarmpi]# pacman -S jre7-openjdk

Setup MPD

[root@alarmpi]# pacman -S mpd
[root@alarmpi]# pacman -S alsa-plugins alsa-utils alsaplayer alsa-tools

This will bring up (at least on the cubox-i) a question on the libgl provider, I have chosen to use mesa-libgl. Could be, that you are better off with another setting.

An example configuration for raspberry pi is shown here.

user "mpd"
pid_file "/run/mpd/"
#db_file "/var/lib/mpd/mpd.db"
state_file "/var/lib/mpd/mpdstate"
playlist_directory "/var/lib/mpd/playlists"
log_file "/var/log/mpd.log"

audio_output {
    type "alsa"
    name "PiALSA"
    device "hw:0,0"

An example configuration for cubox-i is shown here:

user "mpd"
pid_file "/run/mpd/"
#db_file "/var/lib/mpd/mpd.db"
state_file "/var/lib/mpd/mpdstate"
playlist_directory "/var/lib/mpd/playlists"
log_file "/var/log/mpd.log"

audio_output {
   type   "alsa"
   name   "SPDIF out"
   device   "hw:0,0"

On a cubox-i this config will work, but could lead to errors in the log file (/var/log/mpd.log):

alsa_mixer: Failed to read mixer for 'SPDIF out': no such mixer control: PCM

Please note, that the default db is disabled, and MPD is configured to use the "usual" audio output of the Raspberry Pi/cubox-i. If you are using a different USB Audio Device, this should most probably be adopted.

Enable automatic startup of mpd after a reboot.

systemctl start mpd.service
systemctl enable mpd.service

Setup MediaPlayer

We are going to use the latest beta version in this install. If you would like to use a "stable" version, please replace "beta" with "release".

[root@alarmpi]# pacman -S binutils
[root@alarmpi]# pacman -S unzip
[root@alarmpi]# wget -O
[root@alarmpi]# unzip
[root@alarmpi]# mv mediaplayer /opt
[root@alarmpi]# cd /opt/mediaplayer
[root@alarmpi]# chmod +x run.s

The needs to get adopted, so that it fits your needs. An example is shown beneath. Pi (Wohnzimmer)
#player can be either mpd or mplayer
#playlist.max, maximum items allow in playlist. Maximum is 1000
#mplayer settings
#mpd settings
#log settings
#OpenHome settings
#Log Level can be: None, Trace, Thread, Network, Timer, SsdpMulticast, SsdpUnicast, Http, Device,
#XmlFetch, Service, Event, Topology, DvInvocation, DvEvent, DvWebSocket, Bonjour, DvDevice, Error, All, Verbose

The above configuration uses MPD as the media playing device.

Enable MediaPlayer on Boot

[root@alarmpi]# cd /opt/mediaplayer/scripts/systemd
[root@alarmpi]# cp mediaplayer.service /etc/systemd/system/
[root@alarmpi]# cp /opt/mediaplayer
[root@alarmpi]# chmod +x /opt/mediaplayer/

Adopt the mediaplayer.service in /etc/systemd/system/ to reflect your local environment:

Requires=mpd.service mpd.service



Now start the mediaplayer service:

[root@alarmpi]# systemctl start mediaplayer.service
[root@alarmpi]# systemctl enable mediaplayer.service

Enable Plugins

MediaPlayer provides a lot of Plugins which need to be installed separately and on request. In the following we enable the LastFM Plugin to scrobble the played tracks.

[root@alarmpi]# cd /opt/mediaplayer
[root@alarmpi]# mkdir -p plugins/LastFM
[root@alarmpi]# cd plugins/LastFM
[root@alarmpi]# wget -O LastFM.jar
[root@alarmpi]# wget -O LastFM.xml

For the LastFM plugin to work, you need to adopt the LastFM.xml according to your personal preferences. For a detailed description, please see the LastFM Documentation.

Adjust Date/Time Settings

The timezone of the default install of ArchlinuxARM is America/Denver. If you are in a different timezone, you need to adjust this.

[root@alarmpi]# timedatectl set-timezone Europe/Berlin

For detailled information, please take a look on the ArchWiki.