Raspberry Pi - SlideMusicSetup

Submitted by code_admin on Fri, 07/20/2018 - 13:16

This page describes all setup steps I preformed on RaspberryPi to set it up as a SlideMusic Server

DHCP allocation

Setup my router to allocate a constant ip (192.168.1.180)

Pi User Password Change

ssh pi@192.168.1.180
default password (Raspberry)

Use passwd command to change password.

Disable X-Screen Blanking

  1. sudo nano /etc/X11/xinit/xinitrc

Add this at the START of the file

  1. #Added by RJM
  2. xset s off         # don't activate screensaver
  3. xset -dpms         # disable DPMS (Energy Star) features.
  4. xset s noblank     # don't blank the video device
  1. sudo reboot

Add shared drives

First add user and group

This also makes the user Pi a member of share group so it can see the files:

  1. sudo adduser shareuser
  2. sudo addgroup sharegroup
  3. sudo addgroup pi sharegroup
  4. id pi

The last command id pi lists thr groups the user pi is a member of. Check that sharegroup is there in the list

Create Network folder and add credential files

  1. mkdir /home/pi/network
  2. cd /home/pi/network
  3. sudo mkdir DropboxFol
  4. sudo chown shareuser DropboxFol
  5. sudo chgrp sharegroup DropboxFol
  6. sudo echo username=Robert > DropboxFol.credentials
  7. sudo chmod a-r DropboxFol.credentials
  8. sudo chmod g-r DropboxFol.credentials
  9. sudo chown root DropboxFol.credentials
  10. sudo chgrp root DropboxFol.credentials
  11. sudo mkdir robertsmedia
  12. sudo chown shareuser robertsmedia
  13. sudo chgrp sharegroup robertsmedia
  14. sudo echo username=Robert > robertsmedia.credentials
  15. sudo chmod a-r robertsmedia.credentials
  16. sudo chmod g-r robertsmedia.credentials
  17. sudo chown root robertsmedia.credentials
  18. sudo chgrp root robertsmedia.credentials

Add the password to the credentials files:

  1. sudo nano DropboxFol.credentials
  1. username=Robert
  2. password=XXX

Create map script

Create a file

  1. sudo nano /etc/init.d/rjmnetmnt
  1. #!/bin/sh
  2.  
  3. #
  4. #Check the input paramaters are correct
  5. #
  6. if [ $# != 1 ]
  7. then
  8.   echo "ERROR - Must supply one paramater"
  9.   exit 1
  10. fi
  11.  
  12. parm_ok=0
  13. for X in "start" "stop"
  14. do
  15.   if [ ${X} =  ${1} ]
  16.   then
  17.     parm_ok=1
  18.   fi
  19. done
  20.  
  21. if [ ${parm_ok} = 0 ]
  22. then
  23.   echo "Parameter 1 is not set correctly"
  24.   echo "It should be start or stop only"
  25.   exit 1
  26. fi
  27.  
  28. if [ $1 = "start" ]
  29. then
  30.    mount -t cifs //192.168.1.160/robertsmedia /home/pi/network/robertsmedia -o credentials=/home/pi/network/robertsmedia.credentials,uid=shareuser,gid=sharegroup
  31.    mount -t cifs //192.168.1.151/DropboxFol /home/pi/network/DropboxFol -o credentials=/home/pi/network/DropboxFol.credentials,uid=shareuser,gid=sharegroup
  32. fi
  33.  
  34. if [ $1 = "stop" ]
  35. then
  36.    umount /home/pi/network/robertsmedia
  37.    umount /home/pi/network/DropboxFol
  38. fi
  39.  
  40. echo "DONE"
  1. sudo chmod +x rjmnetmnt

Test it:

  1. sudo /etc/init.d/rjmnetmnt start
  2. ls /home/pi/network/DropboxFol

Set it for startup

  1. sudo update-rc.d rjmnetmnt defaults

Restart and test again!

Change memory split

top line before I did split

  1. KiB Mem:    448736 total,   163088 used,   285648 free,    13768 buffers
  2. KiB Swap:   102396 total,        0 used,   102396 free,    95008 cached

Split to 128/128 for hight graphics

  1. sudo raspi-config

(Goto advanced - ESC to exit then sudo reboot)

top line after I did split

  1. KiB Mem:    383712 total,   115956 used,   267756 free,    10824 buffers
  2. KiB Swap:   102396 total,        0 used,   102396 free,    56416 cached

Setup Java 8 Early Access

Goto https://jdk8.java.net/download.html
Choose Linux ARMv6/7 VFP, HardFP ABI
copy this file to
/home/pi

  1. sudo tar -zxvf file_name -C /opt
  1. sudo /opt/jdk1.8.0/bin/java -version

Setup SlideMusic java program

  1. mkdir /home/pi/SlideMusic

Create file
/home/pi/SlideMusic/getLatest.sh as

  1. DPDIR=/home/pi/network/DropboxFol
  2. INSTDIR=/home/pi/SlideMusic
  3. cp ${DPDIR}/Projects/SlideMusic/SlideMusicServer/deploy/SlideMusicServer.jar ${INSTDIR}/SlideMusicServer.jar
  4. cp ${DPDIR}/Projects/java_libs/metadata-extractor-2.6.4/metadata-extractor-2.6.4.jar ${INSTDIR}/metadata-extractor-2.6.4.jar
  5. cp ${DPDIR}/Projects/java_libs/metadata-extractor-2.6.4/xmpcore.jar ${INSTDIR}/xmpcore.jar
  6. cp ${DPDIR}/Projects/java_libs/sqlite-jdbc-3.7.2.jar ${INSTDIR}/sqlite-jdbc-3.7.2.jar

/home/pi/SlideMusic/Server.sh as

  1. HDIR=/home/pi/SlideMusic
  2. CP=${HDIR}/SlideMusicServer.jar
  3. CP=${CP}:${HDIR}/sqlite-jdbc-3.7.2.jar
  4. CP=${CP}:${HDIR}/metadata-extractor-2.6.4.jar
  5. CP=${CP}:${HDIR}/xmpcore.jar
  6.  
  7. java -cp ${CP} metcarob.com.slidemusic.server.MainApp ${HDIR}/SlideMusicServer.settings ${1} ${2} ${3} ${4} ${5}

/home/pi/SlideMusic/Client.sh as

  1. HDIR=/home/pi/SlideMusic
  2. CP=${HDIR}/SlideMusicServer.jar
  3. CP=${CP}:${HDIR}/sqlite-jdbc-3.7.2.jar
  4. CP=${CP}:${HDIR}/metadata-extractor-2.6.4.jar
  5. CP=${CP}:${HDIR}/xmpcore.jar
  6.  
  7. java -cp ${CP} metcarob.com.slidemusic.client.MainApp ${1} ${2} ${3} ${4} ${5}

Make executable and install

  1. cd /home/pi/SlideMusic
  2. sudo chmod +x *.sh
  3. ./getLatest.sh

ls and check jar files have copied.

Now run slide music and check if it runs

Set display variable before running scripts

This needs to be done from SSH termnials

  1. export DISPLAY=:0
RJM Article Type
Work Notes